only have a single user with details struct
All checks were successful
CI/CD Pipeline / test (push) Successful in 8m45s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

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

@ -1,6 +1,6 @@
use crate::model::{
role::Role,
user::{SchnupperBetreuerUser, User, UserWithRolesAndNotificationCount},
user::{SchnupperBetreuerUser, User, UserWithDetails},
};
use futures::future::join_all;
use rocket::{get, request::FlashMessage, routes, Route, State};
@ -18,9 +18,9 @@ async fn index(
let user_futures: Vec<_> = User::all_with_role(db, &schnupperant)
.await
.into_iter()
.map(|u| async move { UserWithRolesAndNotificationCount::from_user(u, db).await })
.map(|u| async move { UserWithDetails::from_user(u, db).await })
.collect();
let users: Vec<UserWithRolesAndNotificationCount> = join_all(user_futures).await;
let users: Vec<UserWithDetails> = join_all(user_futures).await;
let mut context = Context::new();
if let Some(msg) = flash {
@ -29,7 +29,7 @@ async fn index(
context.insert("schnupperanten", &users);
context.insert(
"loggedin_user",
&UserWithRolesAndNotificationCount::from_user(user.into(), db).await,
&UserWithDetails::from_user(user.into(), db).await,
);
Template::render("admin/schnupper/index", context.into_json())