disable rowers in logbook if they are on water

This commit is contained in:
2023-09-23 22:13:48 +02:00
parent cbe77ebf0e
commit d102e57b09
5 changed files with 49 additions and 5 deletions

View File

@ -28,6 +28,22 @@ pub struct User {
pub last_access: Option<chrono::NaiveDateTime>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct UserWithWaterStatus {
#[serde(flatten)]
pub user: User,
pub on_water: bool,
}
impl UserWithWaterStatus {
pub async fn from_user(user: User, db: &SqlitePool) -> Self {
Self {
on_water: user.on_water(db).await,
user,
}
}
}
impl PartialEq for User {
fn eq(&self, other: &Self) -> bool {
self.id == other.id