rename RecyclePolicy→RotationPolicy, collapse AccessMode, clean OIDC refs
This commit is contained in:
@@ -11,7 +11,6 @@ pub struct CreateChannelRequest {
|
||||
pub description: Option<String>,
|
||||
pub timezone: String,
|
||||
pub access_mode: Option<String>,
|
||||
pub access_password: Option<String>,
|
||||
pub webhook_url: Option<String>,
|
||||
pub webhook_poll_interval_secs: Option<u32>,
|
||||
pub webhook_body_template: Option<String>,
|
||||
@@ -26,10 +25,9 @@ pub struct UpdateChannelRequest {
|
||||
#[schema(value_type = Option<Object>)]
|
||||
pub schedule_config: Option<domain::models::ScheduleConfigCompat>,
|
||||
#[schema(value_type = Option<Object>)]
|
||||
pub recycle_policy: Option<domain::RecyclePolicy>,
|
||||
pub rotation_policy: Option<domain::RotationPolicy>,
|
||||
pub auto_schedule: Option<bool>,
|
||||
pub access_mode: Option<String>,
|
||||
pub access_password: Option<String>,
|
||||
pub logo: Option<Option<String>>,
|
||||
pub logo_position: Option<String>,
|
||||
pub logo_opacity: Option<f32>,
|
||||
@@ -47,7 +45,7 @@ pub struct ChannelResponse {
|
||||
pub description: Option<String>,
|
||||
pub timezone: String,
|
||||
pub schedule_config: serde_json::Value,
|
||||
pub recycle_policy: serde_json::Value,
|
||||
pub rotation_policy: serde_json::Value,
|
||||
pub auto_schedule: bool,
|
||||
pub access_mode: String,
|
||||
pub logo: Option<String>,
|
||||
@@ -70,7 +68,7 @@ impl From<domain::Channel> for ChannelResponse {
|
||||
description: c.description().map(|s| s.to_string()),
|
||||
timezone: c.timezone().to_string(),
|
||||
schedule_config: serde_json::to_value(c.schedule_config()).unwrap_or_default(),
|
||||
recycle_policy: serde_json::to_value(c.recycle_policy()).unwrap_or_default(),
|
||||
rotation_policy: serde_json::to_value(c.rotation_policy()).unwrap_or_default(),
|
||||
auto_schedule: c.auto_schedule(),
|
||||
access_mode: enum_to_string(c.access_mode()),
|
||||
logo: c.logo().map(|s| s.to_string()),
|
||||
|
||||
@@ -5,8 +5,6 @@ use uuid::Uuid;
|
||||
|
||||
use crate::common::enum_to_string;
|
||||
|
||||
const DEFAULT_ACCESS_MODE: &str = "public";
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
pub struct MediaItemResponse {
|
||||
pub id: String,
|
||||
@@ -47,8 +45,6 @@ pub struct SlotResponse {
|
||||
pub end_at: DateTime<Utc>,
|
||||
pub item: MediaItemResponse,
|
||||
pub source_block_id: Uuid,
|
||||
#[serde(default)]
|
||||
pub block_access_mode: String,
|
||||
}
|
||||
|
||||
impl From<domain::ScheduledSlot> for SlotResponse {
|
||||
@@ -59,26 +55,6 @@ impl From<domain::ScheduledSlot> for SlotResponse {
|
||||
end_at: s.end_at(),
|
||||
item: s.item().clone().into(),
|
||||
source_block_id: s.source_block_id().value(),
|
||||
block_access_mode: String::from(DEFAULT_ACCESS_MODE),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SlotResponse {
|
||||
pub fn with_block_access(slot: domain::ScheduledSlot, channel: &domain::Channel) -> Self {
|
||||
let block_access_mode = channel
|
||||
.schedule_config()
|
||||
.all_blocks()
|
||||
.find(|b| b.id() == slot.source_block_id())
|
||||
.map(|b| enum_to_string(b.access_mode()))
|
||||
.unwrap_or_else(|| String::from(DEFAULT_ACCESS_MODE));
|
||||
Self {
|
||||
id: slot.id().value(),
|
||||
start_at: slot.start_at(),
|
||||
end_at: slot.end_at(),
|
||||
item: slot.item().clone().into(),
|
||||
source_block_id: slot.source_block_id().value(),
|
||||
block_access_mode,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +63,6 @@ impl SlotResponse {
|
||||
pub struct CurrentBroadcastResponse {
|
||||
pub slot: SlotResponse,
|
||||
pub offset_secs: u32,
|
||||
pub block_access_mode: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
|
||||
|
||||
Reference in New Issue
Block a user