main #111
@ -76,10 +76,6 @@ WHERE trip.id=?
|
|||||||
return Err(CoxHelpError::DetailsLocked);
|
return Err(CoxHelpError::DetailsLocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
if planned_event.is_rower_registered(db, cox).await {
|
|
||||||
return Err(CoxHelpError::AlreadyRegisteredAsRower);
|
|
||||||
}
|
|
||||||
|
|
||||||
match sqlx::query!(
|
match sqlx::query!(
|
||||||
"INSERT INTO trip (cox_id, planned_event_id) VALUES(?, ?)",
|
"INSERT INTO trip (cox_id, planned_event_id) VALUES(?, ?)",
|
||||||
cox.id,
|
cox.id,
|
||||||
@ -140,14 +136,7 @@ WHERE day=?
|
|||||||
return Err(TripUpdateError::NotYourTrip);
|
return Err(TripUpdateError::NotYourTrip);
|
||||||
}
|
}
|
||||||
|
|
||||||
let trip_details = sqlx::query!(
|
let Some(trip_details_id) = trip.trip_details_id else {
|
||||||
"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?
|
return Err(TripUpdateError::TripDetailsDoesNotExist); //TODO: Remove?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user