Skip to content

Commit

Permalink
Fix CI checks
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroslvieira committed Dec 11, 2023
1 parent c7428ed commit 7f2021e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 5 additions & 8 deletions api/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ pub async fn delete_project(
Extension(pool): Extension<PgPool>,
Extension(client): Extension<Client>,
) -> Result<StatusCode> {

// Delete assets from bucket
let saved_project: Project = sqlx::query_scalar!(
r#"SELECT project as "project: sqlx::types::Json<Project>" FROM projects WHERE id = $1"#,
Expand All @@ -262,18 +261,16 @@ pub async fn delete_project(
.fetch_one(&pool)
.await?
.0;

if !saved_project.assets.is_empty() {
delete_assets(client, &saved_project.assets).await
}

// Delete project from database
let delete_project = sqlx::query(
r#"DELETE FROM projects WHERE id = $1"#,
)
.bind(id)
.execute(&pool)
.await?;
sqlx::query(r#"DELETE FROM projects WHERE id = $1"#)
.bind(id)
.execute(&pool)
.await?;

Ok(StatusCode::NO_CONTENT)
}
Expand Down
6 changes: 4 additions & 2 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use axum::{
extract::Extension,
http::{HeaderValue, Method},
routing::delete,
routing::get,
routing::post,
routing::put,
routing::delete,
Router,
};
use clap::Parser;
Expand Down Expand Up @@ -49,7 +49,9 @@ pub async fn app(pool: PgPool) -> Router {
.route("/api/projects/duplicate", post(handlers::duplicate_project))
.route(
"/api/projects/:id",
get(handlers::get_project).put(handlers::update_project).delete(handlers::delete_project),
get(handlers::get_project)
.put(handlers::update_project)
.delete(handlers::delete_project),
)
.route(
"/api/projects/:id/geometries",
Expand Down

0 comments on commit 7f2021e

Please sign in to comment.