Files
diplom/src/web/route/user/get.rs
2025-05-17 23:52:20 +03:00

17 lines
413 B
Rust

use axum::Json;
use axum::extract::{Path, State};
use axum::response::IntoResponse;
use crate::state::AppState;
use crate::web;
use crate::web::entity::user::PartialUser;
pub async fn get_by_id(
State(state): State<AppState>,
Path(user_id): Path<uuid::Uuid>,
) -> web::Result<impl IntoResponse> {
let user = state.database.select_user_by_id(user_id).await?;
Ok(Json(PartialUser::from(user)))
}