@ -5,7 +5,7 @@ use rocket::FromForm;
|
||||
use serde::Serialize;
|
||||
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
||||
|
||||
use super::{boat::Boat, log::Log, rower::Rower, user::User};
|
||||
use super::{boat::Boat, log::Log, notification::Notification, rower::Rower, user::User};
|
||||
|
||||
#[derive(FromRow, Serialize, Clone, Debug)]
|
||||
pub struct Logbook {
|
||||
@ -525,6 +525,23 @@ ORDER BY departure DESC
|
||||
Rower::create(db, self.id, *rower)
|
||||
.await
|
||||
.map_err(|e| LogbookUpdateError::RowerCreateError(*rower, e.to_string()))?;
|
||||
|
||||
let user = User::find_by_id_tx(db, *rower as i32).await.unwrap();
|
||||
Notification::create_with_tx(
|
||||
db,
|
||||
&user,
|
||||
&format!(
|
||||
"Neuer Logbucheintrag: Ausfahrt am {}.{}.{} nach {} ({} km)",
|
||||
dep.day(),
|
||||
dep.month(),
|
||||
dep.year(),
|
||||
log.destination,
|
||||
log.distance_in_km
|
||||
),
|
||||
"Neuer Logbucheintrag",
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
sqlx::query!(
|
||||
|
Reference in New Issue
Block a user