Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backends): permit delete project idempotency #1806

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions backends/src/client/permit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>> {
Expand Down