Add an accommodations reservations module #188
@ -1,7 +1,7 @@
|
|||||||
use crate::constants::StaticConstraints;
|
use crate::constants::StaticConstraints;
|
||||||
use crate::controllers::HttpResult;
|
use crate::controllers::HttpResult;
|
||||||
use crate::extractors::accommodation_extractor::FamilyAndAccommodationInPath;
|
use crate::extractors::accommodation_extractor::FamilyAndAccommodationInPath;
|
||||||
use crate::extractors::family_extractor::FamilyInPathWithAdminMembership;
|
use crate::extractors::family_extractor::{FamilyInPath, FamilyInPathWithAdminMembership};
|
||||||
use crate::models::Accommodation;
|
use crate::models::Accommodation;
|
||||||
use crate::services::accommodations_list_service;
|
use crate::services::accommodations_list_service;
|
||||||
use actix_web::{web, HttpResponse};
|
use actix_web::{web, HttpResponse};
|
||||||
@ -66,6 +66,12 @@ pub async fn create(
|
|||||||
Ok(HttpResponse::Ok().json(accommodation))
|
Ok(HttpResponse::Ok().json(accommodation))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the full list of accommodations
|
||||||
|
pub async fn get_full_list(m: FamilyInPath) -> HttpResult {
|
||||||
|
Ok(HttpResponse::Ok()
|
||||||
|
.json(accommodations_list_service::get_all_of_family(m.family_id()).await?))
|
||||||
|
}
|
||||||
|
|
||||||
/// Delete an accommodation
|
/// Delete an accommodation
|
||||||
pub async fn delete(
|
pub async fn delete(
|
||||||
m: FamilyAndAccommodationInPath,
|
m: FamilyAndAccommodationInPath,
|
||||||
|
@ -210,13 +210,16 @@ async fn main() -> std::io::Result<()> {
|
|||||||
"/family/{id}/accommodations/list/create",
|
"/family/{id}/accommodations/list/create",
|
||||||
web::post().to(accommodations_list_controller::create),
|
web::post().to(accommodations_list_controller::create),
|
||||||
)
|
)
|
||||||
// TODO : update
|
.route(
|
||||||
|
"/family/{id}/accommodations/list/list",
|
||||||
|
web::get().to(accommodations_list_controller::get_full_list),
|
||||||
|
)
|
||||||
.route(
|
.route(
|
||||||
"/family/{id}/accommodations/list/{accommodation_id}",
|
"/family/{id}/accommodations/list/{accommodation_id}",
|
||||||
web::delete().to(accommodations_list_controller::delete),
|
web::delete().to(accommodations_list_controller::delete),
|
||||||
)
|
)
|
||||||
// TODO : list
|
|
||||||
// TODO : get single
|
// TODO : get single
|
||||||
|
// TODO : update
|
||||||
// [ACCOMODATIONS] Reservations controller
|
// [ACCOMODATIONS] Reservations controller
|
||||||
// TODO : create
|
// TODO : create
|
||||||
// TODO : update
|
// TODO : update
|
||||||
|
Loading…
Reference in New Issue
Block a user