diff --git a/src/db/app.rs b/src/db/app.rs index 7e445a6..987b768 100644 --- a/src/db/app.rs +++ b/src/db/app.rs @@ -86,6 +86,12 @@ impl NewAppReq { let new_app_req: Option = db.select((NEW_APP_REQ, id)).await?; Ok(new_app_req) } + + pub async fn delete(db: &Surreal, id: &str) -> Result<(), Error> { + let _: Option = db.delete((NEW_APP_REQ, id)).await?; + Ok(()) + } + pub async fn submit_error(db: &Surreal, 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 = db.insert(()).relation(active_app).await?; - db.delete::>((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 = db.delete((NEW_APP_REQ, app_id)).await?; return Ok(Self::NewAppRes(active_app_notif.data.into())); } } diff --git a/src/grpc/app.rs b/src/grpc/app.rs index 8a595a6..bbd22ac 100644 --- a/src/grpc/app.rs +++ b/src/grpc/app.rs @@ -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.", ))