allow filter for kiosk, to only show boats at specific location

This commit is contained in:
2023-08-05 12:59:02 +02:00
parent 6809a85749
commit 8a40dfe017
3 changed files with 55 additions and 16 deletions

View File

@ -23,6 +23,21 @@ impl Location {
.ok()
}
pub async fn find_by_name(db: &SqlitePool, name: String) -> Option<Self> {
sqlx::query_as!(
Self,
"
SELECT id, name
FROM location
WHERE name=?
",
name
)
.fetch_one(db)
.await
.ok()
}
pub async fn all(db: &SqlitePool) -> Vec<Self> {
sqlx::query_as!(Self, "SELECT id, name FROM location")
.fetch_all(db)