Can delete an accommodation
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use crate::constants::StaticConstraints;
|
||||
use crate::controllers::HttpResult;
|
||||
use crate::extractors::accommodation_extractor::FamilyAndAccommodationInPath;
|
||||
use crate::extractors::family_extractor::FamilyInPathWithAdminMembership;
|
||||
use crate::models::{Accommodation, FamilyID};
|
||||
use crate::models::Accommodation;
|
||||
use crate::services::accommodations_list_service;
|
||||
use crate::services::couples_service::{delete, get_all_of_family};
|
||||
use actix_web::{web, HttpResponse};
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
@@ -66,10 +66,8 @@ pub async fn create(
|
||||
Ok(HttpResponse::Ok().json(accommodation))
|
||||
}
|
||||
|
||||
/// Delete all the accommodations of a family
|
||||
pub async fn delete_all_family(family_id: FamilyID) -> anyhow::Result<()> {
|
||||
for mut m in get_all_of_family(family_id).await? {
|
||||
delete(&mut m).await?;
|
||||
}
|
||||
Ok(())
|
||||
/// Delete an accommodation
|
||||
pub async fn delete(m: FamilyAndAccommodationInPath) -> HttpResult {
|
||||
accommodations_list_service::delete(&mut m.to_accommodation()).await?;
|
||||
Ok(HttpResponse::Ok().finish())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user