feat: show user avatars on /users page
All checks were successful
CI / Check / Test / Build (push) Successful in 24m46s

This commit is contained in:
2026-05-13 23:45:19 +02:00
parent 19171806b9
commit e41d85bd7e
8 changed files with 33 additions and 7 deletions

View File

@@ -240,6 +240,7 @@ pub(crate) struct UserSummaryRow {
pub email: String,
pub total_movies: i64,
pub avg_rating: Option<f64>,
pub avatar_path: Option<String>,
}
impl UserSummaryRow {
@@ -249,6 +250,7 @@ impl UserSummaryRow {
Email::new(self.email)?,
self.total_movies,
self.avg_rating,
self.avatar_path,
))
}
}

View File

@@ -229,10 +229,11 @@ impl UserRepository for SqliteUserRepository {
r#"SELECT u.id AS "id!: String",
u.email AS "email!: String",
COUNT(DISTINCT r.movie_id) AS "total_movies!: i64",
AVG(CAST(r.rating AS REAL)) AS avg_rating
AVG(CAST(r.rating AS REAL)) AS avg_rating,
u.avatar_path
FROM users u
LEFT JOIN reviews r ON r.user_id = u.id AND r.remote_actor_url IS NULL
GROUP BY u.id, u.email
GROUP BY u.id, u.email, u.avatar_path
ORDER BY u.email ASC"#
)
.fetch_all(&self.pool)