Can get the full list of accommodation reservations for a family
This commit is contained in:
@ -29,7 +29,7 @@ pub async fn get_by_id(id: AccommodationID) -> anyhow::Result<Accommodation> {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get all the couples of an accommodation
|
||||
/// Get all the accommodations of a family
|
||||
pub async fn get_all_of_family(id: FamilyID) -> anyhow::Result<Vec<Accommodation>> {
|
||||
db_connection::execute(|conn| {
|
||||
accommodations_list::table
|
||||
@ -57,7 +57,7 @@ pub async fn exists(
|
||||
})
|
||||
}
|
||||
|
||||
/// Update the information of a couple
|
||||
/// Update the information of an accommodation
|
||||
pub async fn update(accommodation: &mut Accommodation) -> anyhow::Result<()> {
|
||||
accommodation.time_update = time() as i64;
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
use crate::connections::db_connection;
|
||||
use crate::models::{AccommodationReservation, FamilyID};
|
||||
use crate::schema::accommodations_reservations;
|
||||
use diesel::prelude::*;
|
||||
|
||||
/// Get all the accommodations reservations of a family
|
||||
pub async fn get_all_of_family(id: FamilyID) -> anyhow::Result<Vec<AccommodationReservation>> {
|
||||
db_connection::execute(|conn| {
|
||||
accommodations_reservations::table
|
||||
.filter(accommodations_reservations::dsl::family_id.eq(id.0))
|
||||
.get_results(conn)
|
||||
})
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
//! # Backend services
|
||||
|
||||
pub mod accommodations_list_service;
|
||||
pub mod accommodations_reservations_service;
|
||||
pub mod couples_service;
|
||||
pub mod families_service;
|
||||
pub mod login_token_service;
|
||||
|
Reference in New Issue
Block a user