User endpoints

This commit is contained in:
2024-07-30 20:21:33 +03:00
parent 33356f34e8
commit d4c1cdb582
32 changed files with 551 additions and 94 deletions

View File

@ -0,0 +1,16 @@
use crate::prelude::*;
#[derive(Deserialize, Debug)]
pub struct Params {
user_id: i32,
}
pub async fn get(
State(state): State<AppState>,
Query(params): Query<Params>,
) -> Result<Json<db::users::UserInfo>, StatusCode> {
let info = db::users::get(params.user_id, &state.pool)
.await
.handle_internal()?;
Ok(Json(info))
}