From e081c7a31f001ab11feb23399586d1da755af16a Mon Sep 17 00:00:00 2001 From: philipp Date: Fri, 1 Dec 2023 10:10:18 +0100 Subject: [PATCH] cleaner code --- src/model/trip.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/model/trip.rs b/src/model/trip.rs index b8f99e1..2eba4ae 100644 --- a/src/model/trip.rs +++ b/src/model/trip.rs @@ -76,10 +76,6 @@ 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, @@ -140,14 +136,7 @@ WHERE day=? return Err(TripUpdateError::NotYourTrip); } - 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 { + let Some(trip_details_id) = trip.trip_details_id else { return Err(TripUpdateError::TripDetailsDoesNotExist); //TODO: Remove? }; -- 2.45.2