only have a single user with details struct

This commit is contained in:
2024-05-06 12:17:03 +02:00
parent fcb4d65d32
commit 45b51f4698
14 changed files with 49 additions and 85 deletions

View File

@@ -23,7 +23,7 @@ use tera::Context;
use crate::model::{
notification::Notification,
role::Role,
user::{User, UserWithRolesAndNotificationCount},
user::{User, UserWithDetails},
};
pub(crate) mod admin;
@@ -53,10 +53,7 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_
}
context.insert("notifications", &Notification::for_user(db, &user).await);
context.insert(
"loggedin_user",
&UserWithRolesAndNotificationCount::from_user(user, db).await,
);
context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await);
Template::render("index", context.into_json())
}
@@ -78,10 +75,7 @@ async fn steering(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage
context.insert("coxes", &coxes);
context.insert("bootskundige", &bootskundige);
context.insert(
"loggedin_user",
&UserWithRolesAndNotificationCount::from_user(user, db).await,
);
context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await);
Template::render("steering", context.into_json())
}