feat(openapi): add search and people endpoints to Swagger/Scalar
This commit is contained in:
@@ -1097,6 +1097,14 @@ pub async fn export_diary(
|
||||
// Search and person endpoints are intentionally public — browsing the catalog
|
||||
// and people profiles does not require authentication.
|
||||
|
||||
#[utoipa::path(
|
||||
get, path = "/api/v1/search",
|
||||
params(api_types::search::SearchQueryParams),
|
||||
responses(
|
||||
(status = 200, body = api_types::search::SearchResponse),
|
||||
),
|
||||
tag = "search",
|
||||
)]
|
||||
pub async fn get_search(
|
||||
State(state): State<AppState>,
|
||||
Query(params): Query<SearchQueryParams>,
|
||||
@@ -1151,6 +1159,15 @@ pub async fn get_search(
|
||||
}
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get, path = "/api/v1/people/{id}",
|
||||
params(("id" = Uuid, Path, description = "Person ID")),
|
||||
responses(
|
||||
(status = 200, body = api_types::search::PersonDto),
|
||||
(status = 404, description = "Person not found"),
|
||||
),
|
||||
tag = "search",
|
||||
)]
|
||||
pub async fn get_person_handler(
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<uuid::Uuid>,
|
||||
@@ -1171,6 +1188,15 @@ pub async fn get_person_handler(
|
||||
}
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get, path = "/api/v1/people/{id}/credits",
|
||||
params(("id" = Uuid, Path, description = "Person ID")),
|
||||
responses(
|
||||
(status = 200, body = api_types::search::PersonCreditsDto),
|
||||
(status = 404, description = "Person not found"),
|
||||
),
|
||||
tag = "search",
|
||||
)]
|
||||
pub async fn get_person_credits_handler(
|
||||
State(state): State<AppState>,
|
||||
Path(id): Path<uuid::Uuid>,
|
||||
|
||||
@@ -2,6 +2,7 @@ mod auth;
|
||||
mod diary;
|
||||
mod import;
|
||||
mod movies;
|
||||
mod search;
|
||||
mod social;
|
||||
mod users;
|
||||
|
||||
@@ -36,6 +37,7 @@ fn build() -> utoipa::openapi::OpenApi {
|
||||
api.merge(movies::MoviesDoc::openapi());
|
||||
api.merge(users::UsersDoc::openapi());
|
||||
api.merge(import::ImportDoc::openapi());
|
||||
api.merge(search::SearchDoc::openapi());
|
||||
#[cfg(feature = "federation")]
|
||||
api.merge(social::SocialDoc::openapi());
|
||||
SecurityAddon.modify(&mut api);
|
||||
|
||||
29
crates/presentation/src/openapi/search.rs
Normal file
29
crates/presentation/src/openapi/search.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use api_types::search::{
|
||||
CastCreditDto, CrewCreditDto, MovieSearchHitDto, PaginatedMovieHits, PaginatedPersonHits,
|
||||
PersonCreditsDto, PersonDto, PersonSearchHitDto, SearchResponse,
|
||||
};
|
||||
use utoipa::OpenApi;
|
||||
|
||||
#[derive(OpenApi)]
|
||||
#[openapi(
|
||||
paths(
|
||||
crate::handlers::api::get_search,
|
||||
crate::handlers::api::get_person_handler,
|
||||
crate::handlers::api::get_person_credits_handler,
|
||||
),
|
||||
components(schemas(
|
||||
SearchResponse,
|
||||
PaginatedMovieHits,
|
||||
PaginatedPersonHits,
|
||||
MovieSearchHitDto,
|
||||
PersonSearchHitDto,
|
||||
PersonDto,
|
||||
PersonCreditsDto,
|
||||
CastCreditDto,
|
||||
CrewCreditDto,
|
||||
)),
|
||||
tags(
|
||||
(name = "search", description = "Full-text search across movies and people"),
|
||||
),
|
||||
)]
|
||||
pub struct SearchDoc;
|
||||
Reference in New Issue
Block a user