Fix error handling in list_users and clean up comments in UpdateRole and UpdateQuota structs
This commit is contained in:
parent
e087c120e7
commit
e6dc119357
|
@ -17,7 +17,7 @@ pub async fn list_users(pool: &State<PgPool>, user: AuthenticatedUser) -> Result
|
||||||
)
|
)
|
||||||
.fetch_all(pool.inner())
|
.fetch_all(pool.inner())
|
||||||
.await
|
.await
|
||||||
.map_err(|_| Status::InternalServerError)?; // Fixed error handling
|
.map_err(|_| Status::InternalServerError)?;
|
||||||
|
|
||||||
Ok(Json(users))
|
Ok(Json(users))
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ pub async fn list_users(pool: &State<PgPool>, user: AuthenticatedUser) -> Result
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct UpdateRole {
|
pub struct UpdateRole {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
pub new_role: String, // e.g. "admin" or "user"
|
pub new_role: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/user/role", data = "<data>")]
|
#[post("/user/role", data = "<data>")]
|
||||||
|
@ -62,7 +62,7 @@ pub async fn update_role(pool: &State<PgPool>, user: AuthenticatedUser, data: Js
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct UpdateQuota {
|
pub struct UpdateQuota {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
pub quota: i64, // in bytes
|
pub quota: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/user/quota", data = "<data>")]
|
#[post("/user/quota", data = "<data>")]
|
||||||
|
|
Loading…
Reference in a new issue