in preparation to moving userdata into app, we switched to arbitrary groups
This commit is contained in:
@ -23,7 +23,7 @@ use crate::model::{
|
||||
LogbookUpdateError,
|
||||
},
|
||||
logtype::LogType,
|
||||
user::{NonGuestUser, User, UserWithWaterStatus},
|
||||
user::{NonGuestUser, User, UserWithRoles, UserWithWaterStatus},
|
||||
};
|
||||
|
||||
pub struct KioskCookie(String);
|
||||
@ -76,7 +76,10 @@ async fn index(
|
||||
context.insert("coxes", &coxes);
|
||||
context.insert("users", &users);
|
||||
context.insert("logtypes", &logtypes);
|
||||
context.insert("loggedin_user", &user.user);
|
||||
context.insert(
|
||||
"loggedin_user",
|
||||
&UserWithRoles::from_user(user.user, db).await,
|
||||
);
|
||||
context.insert("on_water", &on_water);
|
||||
context.insert("distances", &distances);
|
||||
|
||||
@ -87,7 +90,10 @@ async fn index(
|
||||
async fn show(db: &State<SqlitePool>, user: NonGuestUser) -> Template {
|
||||
let logs = Logbook::completed(db).await;
|
||||
|
||||
Template::render("log.completed", context!(logs, loggedin_user: &user.user))
|
||||
Template::render(
|
||||
"log.completed",
|
||||
context!(logs, loggedin_user: &UserWithRoles::from_user(user.user, db).await),
|
||||
)
|
||||
}
|
||||
|
||||
#[get("/show")]
|
||||
@ -232,7 +238,7 @@ async fn create_kiosk(
|
||||
)
|
||||
.await;
|
||||
|
||||
create_logbook(db, data, &NonGuestUser::try_from(creator).unwrap()).await //TODO: fixme
|
||||
create_logbook(db, data, &NonGuestUser { user: creator }).await //TODO: fixme
|
||||
}
|
||||
|
||||
async fn home_logbook(
|
||||
@ -279,12 +285,11 @@ async fn home_kiosk(
|
||||
db,
|
||||
data,
|
||||
logbook_id,
|
||||
&NonGuestUser::try_from(
|
||||
User::find_by_id(db, logbook.shipmaster as i32)
|
||||
&NonGuestUser {
|
||||
user: User::find_by_id(db, logbook.shipmaster as i32)
|
||||
.await
|
||||
.unwrap(), //TODO: fixme
|
||||
)
|
||||
.unwrap(),
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
Reference in New Issue
Block a user