pinakes-server: add utoipa annotations to all routes; fix tests
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I28cf5b7b7cff8e90e123d624d97cf9656a6a6964
This commit is contained in:
parent
67b8322705
commit
9d58927cb4
60 changed files with 3493 additions and 242 deletions
|
|
@ -11,6 +11,20 @@ use crate::{
|
|||
state::AppState,
|
||||
};
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/v1/media/{id}/transcode",
|
||||
tag = "transcode",
|
||||
params(("id" = Uuid, Path, description = "Media item ID")),
|
||||
request_body = CreateTranscodeRequest,
|
||||
responses(
|
||||
(status = 200, description = "Transcode job submitted"),
|
||||
(status = 400, description = "Bad request"),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 500, description = "Internal server error"),
|
||||
),
|
||||
security(("bearer_auth" = []))
|
||||
)]
|
||||
pub async fn start_transcode(
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<Uuid>,
|
||||
|
|
@ -29,6 +43,18 @@ pub async fn start_transcode(
|
|||
Ok(Json(serde_json::json!({"job_id": job_id.to_string()})))
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/v1/transcode/{id}",
|
||||
tag = "transcode",
|
||||
params(("id" = Uuid, Path, description = "Transcode session ID")),
|
||||
responses(
|
||||
(status = 200, description = "Transcode session details", body = TranscodeSessionResponse),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 404, description = "Not found"),
|
||||
),
|
||||
security(("bearer_auth" = []))
|
||||
)]
|
||||
pub async fn get_session(
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<Uuid>,
|
||||
|
|
@ -37,6 +63,16 @@ pub async fn get_session(
|
|||
Ok(Json(TranscodeSessionResponse::from(session)))
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/v1/transcode",
|
||||
tag = "transcode",
|
||||
responses(
|
||||
(status = 200, description = "List of transcode sessions", body = Vec<TranscodeSessionResponse>),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
),
|
||||
security(("bearer_auth" = []))
|
||||
)]
|
||||
pub async fn list_sessions(
|
||||
State(state): State<AppState>,
|
||||
Query(params): Query<PaginationParams>,
|
||||
|
|
@ -51,6 +87,18 @@ pub async fn list_sessions(
|
|||
))
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/v1/transcode/{id}",
|
||||
tag = "transcode",
|
||||
params(("id" = Uuid, Path, description = "Transcode session ID")),
|
||||
responses(
|
||||
(status = 200, description = "Transcode session cancelled"),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 404, description = "Not found"),
|
||||
),
|
||||
security(("bearer_auth" = []))
|
||||
)]
|
||||
pub async fn cancel_session(
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<Uuid>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue