forked from Ruderverein-Donau-Linz/rowt
frontend for new db
This commit is contained in:
@ -239,9 +239,17 @@ ORDER BY departure DESC
|
||||
log: LogToAdd,
|
||||
created_by_user: &User,
|
||||
) -> Result<(), LogbookCreateError> {
|
||||
println!("{log:#?}");
|
||||
let Some(boat) = Boat::find_by_id(db, log.boat_id).await else {
|
||||
return Err(LogbookCreateError::BoatNotFound);
|
||||
};
|
||||
|
||||
if let Ok(log_to_finalize) = TryInto::<LogToFinalize>::try_into(log.clone()) {
|
||||
//TODO: fix clone()
|
||||
|
||||
if !boat.shipmaster_allowed(created_by_user).await {
|
||||
return Err(LogbookCreateError::UserNotAllowedToUseBoat);
|
||||
}
|
||||
|
||||
let mut tx = db.begin().await.unwrap();
|
||||
|
||||
let inserted_row = sqlx::query!(
|
||||
@ -277,10 +285,6 @@ ORDER BY departure DESC
|
||||
return Err(LogbookCreateError::ArrivalSetButNotRemainingTwo);
|
||||
}
|
||||
|
||||
let Some(boat) = Boat::find_by_id(db, log.boat_id).await else {
|
||||
return Err(LogbookCreateError::BoatNotFound);
|
||||
};
|
||||
|
||||
if boat.is_locked(db).await {
|
||||
return Err(LogbookCreateError::BoatLocked);
|
||||
}
|
||||
|
Reference in New Issue
Block a user