move todos to gitlab; write tests for /cox/remove/<id>; Closes #9

This commit is contained in:
2023-07-31 13:34:02 +02:00
parent c4100e6c68
commit bbb78cbc44
3 changed files with 115 additions and 123 deletions

View File

@ -154,7 +154,7 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i
.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?
};
sqlx::query!(
@ -176,7 +176,7 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i
db: &SqlitePool,
cox: &CoxUser,
planned_event: &PlannedEvent,
) {
) -> bool {
sqlx::query!(
"DELETE FROM trip WHERE cox_id = ? AND planned_event_id = ?",
cox.id,
@ -184,7 +184,9 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i
)
.execute(db)
.await
.unwrap(); //TODO: handle case where cox is not registered
.unwrap()
.rows_affected()
> 0
}
pub(crate) async fn delete(