Fix error handling in list_users and clean up comments in UpdateRole and UpdateQuota structs

This commit is contained in:
Mercurio 2025-05-31 21:52:28 +02:00
parent e087c120e7
commit e6dc119357

View file

@ -17,7 +17,7 @@ pub async fn list_users(pool: &State<PgPool>, user: AuthenticatedUser) -> Result
)
.fetch_all(pool.inner())
.await
.map_err(|_| Status::InternalServerError)?; // Fixed error handling
.map_err(|_| Status::InternalServerError)?;
Ok(Json(users))
}
@ -25,7 +25,7 @@ pub async fn list_users(pool: &State<PgPool>, user: AuthenticatedUser) -> Result
#[derive(Deserialize)]
pub struct UpdateRole {
pub user_id: i32,
pub new_role: String, // e.g. "admin" or "user"
pub new_role: String,
}
#[post("/user/role", data = "<data>")]
@ -62,7 +62,7 @@ pub async fn update_role(pool: &State<PgPool>, user: AuthenticatedUser, data: Js
#[derive(Deserialize)]
pub struct UpdateQuota {
pub user_id: i32,
pub quota: i64, // in bytes
pub quota: i64,
}
#[post("/user/quota", data = "<data>")]