show ottensheim boats to rennjugend
This commit is contained in:
@ -185,7 +185,7 @@ ORDER BY amount_seats DESC
|
||||
if user.has_role(db, "admin").await {
|
||||
return Self::all(db).await;
|
||||
}
|
||||
let boats = if user.has_role(db, "cox").await {
|
||||
let mut boats = if user.has_role(db, "cox").await {
|
||||
sqlx::query_as!(
|
||||
Boat,
|
||||
"
|
||||
@ -215,6 +215,23 @@ ORDER BY amount_seats DESC
|
||||
.unwrap() //TODO: fixme
|
||||
};
|
||||
|
||||
if user.has_role(db, "Rennrudern").await {
|
||||
let ottensheim = Location::find_by_name(db, "Ottensheim".into())
|
||||
.await
|
||||
.unwrap();
|
||||
let boats_in_ottensheim = sqlx::query_as!(
|
||||
Boat,
|
||||
"SELECT id, name, amount_seats, location_id, owner, year_built, boatbuilder, default_shipmaster_only_steering, default_destination, skull, external
|
||||
FROM boat
|
||||
WHERE owner is null and location_id = ?
|
||||
ORDER BY amount_seats DESC
|
||||
",ottensheim.id)
|
||||
.fetch_all(db)
|
||||
.await
|
||||
.unwrap(); //TODO: fixme
|
||||
boats.extend(boats_in_ottensheim.into_iter());
|
||||
}
|
||||
|
||||
Self::boats_to_details(db, boats).await
|
||||
}
|
||||
|
||||
|
@ -274,8 +274,6 @@ ORDER BY departure DESC
|
||||
}
|
||||
|
||||
if let Ok(log_to_finalize) = TryInto::<LogToFinalize>::try_into(log.clone()) {
|
||||
//TODO: fix clone() above
|
||||
|
||||
if !boat.shipmaster_allowed(db, created_by_user).await {
|
||||
return Err(LogbookCreateError::UserNotAllowedToUseBoat);
|
||||
}
|
||||
|
Reference in New Issue
Block a user