Add an accommodations reservations module (#188)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Add a new module to enable accommodations reservation  Reviewed-on: #188
This commit is contained in:
@@ -5,7 +5,9 @@ use crate::models::{
|
||||
Family, FamilyID, FamilyMembership, Membership, NewFamily, NewMembership, UserID,
|
||||
};
|
||||
use crate::schema::{families, memberships};
|
||||
use crate::services::{couples_service, members_service, users_service};
|
||||
use crate::services::{
|
||||
accommodations_list_service, couples_service, members_service, users_service,
|
||||
};
|
||||
use crate::utils::string_utils::rand_str;
|
||||
use crate::utils::time_utils::time;
|
||||
use diesel::prelude::*;
|
||||
@@ -127,9 +129,9 @@ pub async fn update_membership(membership: &Membership) -> anyhow::Result<()> {
|
||||
#[derive(serde::Serialize)]
|
||||
pub struct FamilyMember {
|
||||
#[serde(flatten)]
|
||||
membership: Membership,
|
||||
user_name: String,
|
||||
user_mail: String,
|
||||
pub membership: Membership,
|
||||
pub user_name: String,
|
||||
pub user_mail: String,
|
||||
}
|
||||
|
||||
/// Get information about the users of a family
|
||||
@@ -175,6 +177,7 @@ pub async fn update_family(family: &Family) -> anyhow::Result<()> {
|
||||
families::dsl::name.eq(family.name.clone()),
|
||||
families::dsl::invitation_code.eq(family.invitation_code.clone()),
|
||||
families::dsl::enable_genealogy.eq(family.enable_genealogy),
|
||||
families::dsl::enable_accommodations.eq(family.enable_accommodations),
|
||||
families::dsl::disable_couple_photos.eq(family.disable_couple_photos),
|
||||
))
|
||||
.execute(conn)
|
||||
@@ -185,6 +188,9 @@ pub async fn update_family(family: &Family) -> anyhow::Result<()> {
|
||||
|
||||
/// Delete a family
|
||||
pub async fn delete_family(family_id: FamilyID) -> anyhow::Result<()> {
|
||||
// Delete all family accommodations
|
||||
accommodations_list_service::delete_all_family(family_id).await?;
|
||||
|
||||
// Delete all family couples
|
||||
couples_service::delete_all_family(family_id).await?;
|
||||
|
||||
|
Reference in New Issue
Block a user