use crate::prelude::*; #[derive(Deserialize, Debug)] pub struct Params { user_id: i32, } type Response = GeneralResult>; pub async fn get(State(pool): State, Query(params): Query) -> Response { db::users::get(params.user_id, &pool) .await .handle_internal("Error getting the user")? .handle(StatusCode::NOT_FOUND, "User not found") .map(Json) } pub async fn current(state: State, claims: Claims) -> Response { get( state, Query(Params { user_id: claims.user_id, }), ) .await }