Merge branch 'main' into show-waterlevel
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled

This commit is contained in:
2024-05-16 14:45:31 +02:00
24 changed files with 314 additions and 162 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())
}
@ -109,9 +103,7 @@ fn forbidden_error() -> Flash<Redirect> {
Flash::error(Redirect::to("/"), "Keine Berechtigung für diese Aktion. Wenn du der Meinung bist, dass du das machen darfst, melde dich bitte bei it@rudernlinz.at.")
}
struct Usage {
data: Vec<String>,
}
struct Usage {}
#[rocket::async_trait]
impl Fairing for Usage {
@ -197,7 +189,7 @@ pub fn config(rocket: Rocket<Build>) -> Rocket<Build> {
.register("/", catchers![unauthorized_error, forbidden_error])
.attach(Template::fairing())
.attach(AdHoc::config::<Config>())
.attach(Usage { data: Vec::new() })
.attach(Usage {})
}
#[cfg(test)]