only show non-placed boats in boathouse list
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled

This commit is contained in:
2024-04-13 09:42:12 +02:00
parent 3b04b39d66
commit cfc35fbec6
2 changed files with 21 additions and 1 deletions

View File

@ -5,6 +5,8 @@ use rocket::serde::{Deserialize, Serialize};
use rocket::FromForm;
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
use crate::model::boathouse::Boathouse;
use super::location::Location;
use super::user::User;
@ -357,6 +359,17 @@ ORDER BY amount_seats DESC
.await
.unwrap(); //Okay, because we can only create a Boat of a valid id
}
pub async fn boathouse(&self, db: &SqlitePool) -> Option<Boathouse> {
sqlx::query_as!(
Boathouse,
"SELECT * FROM boathouse WHERE boat_id like ?",
self.id
)
.fetch_one(db)
.await
.ok()
}
}
#[cfg(test)]