allow trip_type edit of trip

This commit is contained in:
2023-05-03 16:51:37 +02:00
parent 172901b80f
commit 787b28cc23
6 changed files with 20 additions and 7 deletions

View File

@ -139,6 +139,7 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i
trip: &Trip,
max_people: i32,
notes: Option<String>,
trip_type: Option<i64>, //TODO: Move to `TripType`
) -> Result<(), TripUpdateError> {
if !trip.is_trip_from_user(cox.id).await {
return Err(TripUpdateError::NotYourTrip);
@ -156,9 +157,10 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i
};
sqlx::query!(
"UPDATE trip_details SET max_people = ?, notes = ? WHERE id = ?",
"UPDATE trip_details SET max_people = ?, notes = ?, trip_type_id = ? WHERE id = ?",
max_people,
notes,
trip_type,
trip_details_id
)
.execute(db)