Fix new_app response error

fixed double deleting new_app_req from both daemon and cli side
enhanced new_app logging
This commit is contained in:
Noor 2025-06-19 14:51:51 +03:00
parent 8d1721ca11
commit 376406aa2e
2 changed files with 10 additions and 3 deletions

@ -86,6 +86,12 @@ impl NewAppReq {
let new_app_req: Option<Self> = db.select((NEW_APP_REQ, id)).await?;
Ok(new_app_req)
}
pub async fn delete(db: &Surreal<Client>, id: &str) -> Result<(), Error> {
let _: Option<Self> = db.delete((NEW_APP_REQ, id)).await?;
Ok(())
}
pub async fn submit_error(db: &Surreal<Client>, id: &str, error: String) -> Result<(), Error> {
let tx_query = String::from(
"
@ -361,7 +367,7 @@ impl ActiveApp {
let locked_nano = active_app.locked_nano;
let _: Vec<ActiveApp> = db.insert(()).relation(active_app).await?;
db.delete::<Option<NewAppReq>>((NEW_APP_REQ, &new_app_res.uuid)).await?;
NewAppReq::delete(&db, &new_app_res.uuid).await?;
db.query(format!("UPDATE {ACCOUNT}:{admin_account} SET tmp_locked -= {locked_nano};"))
.await?;
@ -468,7 +474,6 @@ impl WrappedAppResp {
match active_app_notif {
Ok(active_app_notif) =>{
if active_app_notif.action == surrealdb::Action::Create {
let _: Option<NewAppReq> = db.delete((NEW_APP_REQ, app_id)).await?;
return Ok(Self::NewAppRes(active_app_notif.data.into()));
}
}

@ -228,7 +228,9 @@ impl BrainAppCli for AppCliServer {
))
}
Err(e) => {
log::error!("Something weird happened during CLI NewAppReq. Reached error {e:?}");
log::error!(
"Something wrong happened on channel during CLI NewAppReq. Reached error {e:?}"
);
Err(Status::unknown(
"Unknown error. Please try again or contact the DeTEE devs team.",
))