Manage users on admin panel
Some checks failed
Rust / Test (push) Failing after 4m18s
Rust / Rustfmt (push) Successful in 22s
Rust / Clippy (push) Failing after 1m39s
Rust / Code coverage (push) Successful in 4m25s

This commit is contained in:
Alphonse Paix
2025-10-02 22:13:02 +02:00
parent 91e80b4881
commit 96e5dd0f35
12 changed files with 324 additions and 35 deletions

View File

@@ -1,3 +1,4 @@
use crate::routes::get_users;
use crate::{
authentication::AuthenticatedUser,
routes::{AppError, get_max_page, get_subs, get_total_subs},
@@ -45,6 +46,9 @@ pub async fn admin_dashboard(
.await
.context("Could not fetch total subscribers count from the database.")?;
let max_page = get_max_page(count);
let users = get_users(&connection_pool)
.await
.context("Could not fetch users")?;
let template = DashboardTemplate {
user,
idempotency_key_1,
@@ -53,6 +57,7 @@ pub async fn admin_dashboard(
subscribers,
current_page,
max_page,
users,
};
Ok(Html(template.render().unwrap()).into_response())
}