allow trip_type edit of trip
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user