From abd6bf4bc4430b405eed59ab6fd5d40c04b9a902 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sun, 12 Jul 2026 15:30:45 +0200 Subject: [PATCH] fix: add utoipa annotations to iCal export/import handlers --- crates/presentation/src/handlers/schedule.rs | 30 ++++++++++++++++++++ crates/presentation/src/openapi.rs | 2 ++ 2 files changed, 32 insertions(+) diff --git a/crates/presentation/src/handlers/schedule.rs b/crates/presentation/src/handlers/schedule.rs index 1ef738a..a8d36b9 100644 --- a/crates/presentation/src/handlers/schedule.rs +++ b/crates/presentation/src/handlers/schedule.rs @@ -171,6 +171,20 @@ pub async fn list_schedule_history( )) } +#[utoipa::path( + get, + path = "/api/v1/channels/{id}/export.ics", + tag = "schedule", + security(("bearer" = [])), + params( + ("id" = uuid::Uuid, Path, description = "Channel ID"), + ), + responses( + (status = 200, description = "iCalendar file", content_type = "text/calendar"), + (status = 401, body = api_types::ErrorResponse), + (status = 404, body = api_types::ErrorResponse), + ) +)] pub async fn export_ical( State(state): State, CurrentUser(_user): CurrentUser, @@ -202,6 +216,22 @@ pub async fn export_ical( } } +#[utoipa::path( + post, + path = "/api/v1/channels/{id}/import", + tag = "schedule", + security(("bearer" = [])), + params( + ("id" = uuid::Uuid, Path, description = "Channel ID"), + ), + request_body(content = String, content_type = "text/calendar"), + responses( + (status = 200, body = api_types::ChannelResponse), + (status = 400, body = api_types::ErrorResponse), + (status = 401, body = api_types::ErrorResponse), + (status = 404, body = api_types::ErrorResponse), + ) +)] pub async fn import_ical( State(state): State, CurrentUser(user): CurrentUser, diff --git a/crates/presentation/src/openapi.rs b/crates/presentation/src/openapi.rs index 94aa520..bb74c2b 100644 --- a/crates/presentation/src/openapi.rs +++ b/crates/presentation/src/openapi.rs @@ -50,6 +50,8 @@ impl Modify for BearerAuth { crate::handlers::schedule::get_epg, crate::handlers::schedule::get_stream, crate::handlers::schedule::list_schedule_history, + crate::handlers::schedule::export_ical, + crate::handlers::schedule::import_ical, crate::handlers::admin::get_settings, crate::handlers::admin::update_settings, crate::handlers::admin::get_activity_log,