Now checking that user_id from claims exists

This commit is contained in:
2024-08-03 20:15:08 +03:00
parent 9f36d8e663
commit c4ff602ec7
3 changed files with 36 additions and 10 deletions
src
auth.rs
db
endpoints
users

@ -10,7 +10,8 @@ type Response = Result<Json<db::users::UserInfo>, StatusCode>;
pub async fn get(State(pool): State<Pool>, Query(params): Query<Params>) -> Response {
let info = db::users::get(params.user_id, &pool)
.await
.handle_internal()?;
.handle_internal()?
.ok_or(StatusCode::NOT_FOUND)?;
Ok(Json(info))
}