Compare commits

..

No commits in common. "58943bd4e2b0c983d96a4b0f6e7bd1c8808f4252" and "7193760f0507b2ac40e64b44f4013d3e569bb0ab" have entirely different histories.

View File

@ -76,6 +76,10 @@ WHERE trip.id=?
return Err(CoxHelpError::DetailsLocked);
}
if planned_event.is_rower_registered(db, cox).await {
return Err(CoxHelpError::AlreadyRegisteredAsRower);
}
match sqlx::query!(
"INSERT INTO trip (cox_id, planned_event_id) VALUES(?, ?)",
cox.id,
@ -136,7 +140,14 @@ WHERE day=?
return Err(TripUpdateError::NotYourTrip);
}
let Some(trip_details_id) = trip.trip_details_id else {
let trip_details = sqlx::query!(
"SELECT trip_details_id as id FROM trip WHERE id = ?",
trip.id
)
.fetch_one(db)
.await
.unwrap(); //Okay, as trip can only be created with proper DB backing
let Some(trip_details_id) = trip_details.id else {
return Err(TripUpdateError::TripDetailsDoesNotExist); //TODO: Remove?
};