add notification to all pot. coxes if trip is full

This commit is contained in:
2024-04-15 18:16:43 +02:00
parent 1869b36e09
commit 74505c1554
3 changed files with 69 additions and 3 deletions

View File

@ -30,12 +30,12 @@ pub struct Trip {
pub struct TripWithUserAndType {
#[serde(flatten)]
pub trip: Trip,
rower: Vec<Registration>,
pub rower: Vec<Registration>,
trip_type: Option<TripType>,
}
impl TripWithUserAndType {
async fn from(db: &SqlitePool, trip: Trip) -> Self {
pub async fn from(db: &SqlitePool, trip: Trip) -> Self {
let mut trip_type = None;
if let Some(trip_type_id) = trip.trip_type_id {
trip_type = TripType::find_by_id(db, trip_type_id).await;
@ -230,6 +230,9 @@ WHERE day=?
}
}
let trip_details = TripDetails::find_by_id(db, trip_details_id).await.unwrap();
trip_details.check_free_spaces(db).await;
Ok(())
}