wire gap_filler into schedule engine, API, MCP

This commit is contained in:
2026-07-12 14:08:55 +02:00
parent 8edd7a9c0b
commit 79e975f057
9 changed files with 243 additions and 3 deletions

View File

@@ -47,6 +47,7 @@ pub struct UpdateChannelParams {
pub timezone: Option<String>,
pub description: Option<String>,
pub schedule_config_json: Option<String>,
pub gap_filler_json: Option<String>,
}
#[derive(Debug, Deserialize, JsonSchema)]
@@ -98,7 +99,7 @@ impl KTvMcpServer {
channels::create_channel(&self.channel_cmd_deps, self.owner_id, &p.name, &p.timezone).await
}
#[tool(description = "Update channel name, timezone, description, and/or schedule config")]
#[tool(description = "Update channel name, timezone, description, schedule config, and/or gap_filler")]
async fn update_channel(&self, #[tool(aggr)] p: UpdateChannelParams) -> String {
let id = match parse_uuid(&p.id) {
Ok(id) => id,
@@ -114,6 +115,17 @@ impl KTvMcpServer {
},
None => None,
};
let gap_filler = match p.gap_filler_json {
Some(json) if json == "null" => Some(None),
Some(json) => match serde_json::from_str(&json) {
Ok(f) => Some(Some(f)),
Err(e) => {
return serde_json::json!({"error": format!("invalid gap_filler_json: {e}")})
.to_string()
}
},
None => None,
};
channels::update_channel(
&self.channel_cmd_deps,
id,
@@ -122,6 +134,7 @@ impl KTvMcpServer {
p.timezone,
p.description,
schedule_config,
gap_filler,
)
.await
}

View File

@@ -53,6 +53,7 @@ pub async fn update_channel(
timezone: Option<String>,
description: Option<String>,
schedule_config: Option<domain::ScheduleConfig>,
gap_filler: Option<Option<domain::MediaFilter>>,
) -> String {
let cmd = UpdateChannelCommand {
channel_id: channel_id.into(),
@@ -63,6 +64,7 @@ pub async fn update_channel(
schedule_config,
rotation_policy: None,
auto_schedule: None,
gap_filler,
};
match application::channels::update::execute(cmd_deps, cmd).await {
Ok(channel) => ok_json(&channel),