allow adding rowers to logbook

This commit is contained in:
2023-07-24 13:01:39 +02:00
parent c43feb1834
commit c42cd2cd9c
9 changed files with 273 additions and 65 deletions

View File

@ -48,7 +48,22 @@ impl Boat {
// .await
// .ok()
// }
//
pub async fn is_locked(&self, db: &SqlitePool) -> bool {
sqlx::query!("SELECT * FROM boat_damage WHERE boat_id=? AND lock_boat=true AND user_id_verified is null", self.id).fetch_optional(db).await.unwrap().is_some()
}
pub async fn on_water(&self, db: &SqlitePool) -> bool {
sqlx::query!(
"SELECT * FROM logbook WHERE boat_id=? AND arrival is null",
self.id
)
.fetch_optional(db)
.await
.unwrap()
.is_some()
}
pub async fn all(db: &SqlitePool) -> Vec<Self> {
sqlx::query_as!(
Boat,