fight unuseds, sessions endpoint
This commit is contained in:
24
src/api/sessions.rs
Normal file
24
src/api/sessions.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
use axum::{
|
||||
Json,
|
||||
extract::Path,
|
||||
http::HeaderMap,
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
api::CompositeError,
|
||||
users::{
|
||||
User,
|
||||
auth::{UserAuthRequired, UserAuthenticate},
|
||||
sessions::Session,
|
||||
},
|
||||
};
|
||||
|
||||
pub async fn get_by_id(
|
||||
Path(id): Path<Uuid>,
|
||||
headers: HeaderMap,
|
||||
) -> Result<Response, CompositeError> {
|
||||
User::authenticate(&headers)?.required()?;
|
||||
Ok(Json(Session::get_by_id(id)?).into_response())
|
||||
}
|
||||
Reference in New Issue
Block a user