From 3a219ff9e215943cf395b5f530321d7c6f0d6a54 Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Mon, 7 Aug 2023 19:31:05 +0200 Subject: [PATCH] Can delete a couple information --- geneit_backend/src/controllers/couples_controller.rs | 6 ++++++ geneit_backend/src/main.rs | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/geneit_backend/src/controllers/couples_controller.rs b/geneit_backend/src/controllers/couples_controller.rs index 87dafe7..1a64aaa 100644 --- a/geneit_backend/src/controllers/couples_controller.rs +++ b/geneit_backend/src/controllers/couples_controller.rs @@ -144,3 +144,9 @@ pub async fn update(m: FamilyAndCoupleInPath, req: web::Json) -> Ok(HttpResponse::Accepted().finish()) } + +/// Delete a couple +pub async fn delete(m: FamilyAndCoupleInPath) -> HttpResult { + couples_service::delete(&mut m.to_couple()).await?; + Ok(HttpResponse::Ok().finish()) +} diff --git a/geneit_backend/src/main.rs b/geneit_backend/src/main.rs index c7f30e2..a28d1a7 100644 --- a/geneit_backend/src/main.rs +++ b/geneit_backend/src/main.rs @@ -179,6 +179,10 @@ async fn main() -> std::io::Result<()> { "/family/{id}/couple/{couple_id}", web::put().to(couples_controller::update), ) + .route( + "/family/{id}/couple/{couple_id}", + web::delete().to(couples_controller::delete), + ) // Photos controller .route( "/photo/{id}",