Skip to content

Commit

Permalink
feat(backends): permit delete project idempotency (#1806)
Browse files Browse the repository at this point in the history
jonaro00 authored Jun 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3b5e9f8 commit fbc011a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions backends/src/client/permit.rs
Original file line number Diff line number Diff line change
@@ -413,13 +413,26 @@ impl PermissionsDal for Client {
}

async fn delete_project(&self, project_id: &str) -> Result<()> {
Ok(delete_resource_instance(
if let Err(e) = delete_resource_instance(
&self.api,
&self.proj_id,
&self.env_id,
format!("Project:{project_id}").as_str(),
)
.await?)
.await
{
// Return all errors except 404's (project already deleted)
let e: Error = e.into();
if let Error::ResponseError(ref re) = e {
if re.status != StatusCode::NOT_FOUND {
return Err(e);
}
} else {
return Err(e);
}
}

Ok(())
}

async fn get_personal_projects(&self, user_id: &str) -> Result<Vec<String>> {

0 comments on commit fbc011a

Please sign in to comment.