From 9a4da0462a73f2155acc38f18ba86af4ad4c5bae Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 25 May 2024 07:54:34 +0200 Subject: [PATCH] Get single accommodation information --- .../src/controllers/accommodations_list_controller.rs | 5 +++++ geneit_backend/src/main.rs | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/geneit_backend/src/controllers/accommodations_list_controller.rs b/geneit_backend/src/controllers/accommodations_list_controller.rs index 505a7c5..45613bc 100644 --- a/geneit_backend/src/controllers/accommodations_list_controller.rs +++ b/geneit_backend/src/controllers/accommodations_list_controller.rs @@ -72,6 +72,11 @@ pub async fn get_full_list(m: FamilyInPath) -> HttpResult { .json(accommodations_list_service::get_all_of_family(m.family_id()).await?)) } +/// Get the information of a single accommodation +pub async fn get_single(m: FamilyAndAccommodationInPath) -> HttpResult { + Ok(HttpResponse::Ok().json(&m.to_accommodation())) +} + /// Delete an accommodation pub async fn delete( m: FamilyAndAccommodationInPath, diff --git a/geneit_backend/src/main.rs b/geneit_backend/src/main.rs index 92c749a..d861667 100644 --- a/geneit_backend/src/main.rs +++ b/geneit_backend/src/main.rs @@ -214,12 +214,15 @@ async fn main() -> std::io::Result<()> { "/family/{id}/accommodations/list/list", web::get().to(accommodations_list_controller::get_full_list), ) + .route( + "/family/{id}/accommodations/list/{accommodation_id}", + web::get().to(accommodations_list_controller::get_single), + ) + // TODO : update .route( "/family/{id}/accommodations/list/{accommodation_id}", web::delete().to(accommodations_list_controller::delete), ) - // TODO : get single - // TODO : update // [ACCOMODATIONS] Reservations controller // TODO : create // TODO : update