switch to macro for special user
Some checks failed
CI/CD Pipeline / test (push) Failing after 15m6s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2024-08-19 10:34:37 +02:00
parent c41dc0853a
commit 799e94a50f
13 changed files with 92 additions and 287 deletions

View File

@ -96,7 +96,7 @@ async fn index(
context.insert("logtypes", &logtypes);
context.insert(
"loggedin_user",
&UserWithDetails::from_user(user.into(), db).await,
&UserWithDetails::from_user(user.into_inner(), db).await,
);
context.insert("on_water", &on_water);
context.insert("distances", &distances);
@ -110,7 +110,7 @@ async fn show(db: &State<SqlitePool>, user: DonauLinzUser) -> Template {
Template::render(
"log.completed",
context!(logs, loggedin_user: &UserWithDetails::from_user(user.into(), db).await),
context!(logs, loggedin_user: &UserWithDetails::from_user(user.into_inner(), db).await),
)
}
@ -287,7 +287,8 @@ async fn create_kiosk(
)
.await;
create_logbook(db, data, &DonauLinzUser(creator)).await //TODO: fixme
create_logbook(db, data, &DonauLinzUser::new(db, creator).await.unwrap()).await
//TODO: fixme
}
#[post("/update", data = "<data>")]
@ -302,7 +303,7 @@ async fn update(
return Flash::error(Redirect::to("/log"), &format!("Logbucheintrag kann nicht bearbeitet werden, da es einen Logbuch-Eintrag mit ID={} nicht gibt", data.id));
};
match logbook.update(db, data.clone(), &user.0).await {
match logbook.update(db, data.clone(), &user.user).await {
Ok(()) => {
Log::create(
db,
@ -372,11 +373,14 @@ async fn home_kiosk(
db,
data,
logbook_id,
&DonauLinzUser(
&DonauLinzUser::new(
db,
User::find_by_id(db, logbook.shipmaster as i32)
.await
.unwrap(),
), //TODO: fixme
)
.await
.unwrap(),
)
.await
}