check if shipmaster is already on the water

This commit is contained in:
2023-07-27 15:00:52 +02:00
parent 621058356d
commit 0c906f2bda
3 changed files with 19 additions and 0 deletions

View File

@ -93,6 +93,17 @@ WHERE name like ?
.ok()
}
pub async fn on_water(&self, db: &SqlitePool) -> bool {
sqlx::query!(
"SELECT * FROM logbook WHERE shipmaster=? AND arrival is null",
self.id
)
.fetch_optional(db)
.await
.unwrap()
.is_some()
}
pub async fn all(db: &SqlitePool) -> Vec<Self> {
sqlx::query_as!(
User,