feat(channel): add logo support with position and opacity settings

This commit is contained in:
2026-03-14 02:27:16 +01:00
parent e610c23fea
commit da714840ee
11 changed files with 204 additions and 6 deletions

View File

@@ -76,6 +76,10 @@ pub struct UpdateChannelRequest {
pub access_mode: Option<domain::AccessMode>,
/// Empty string clears the password; non-empty re-hashes.
pub access_password: Option<String>,
/// `Some(None)` = clear logo, `Some(Some(url))` = set logo, `None` = unchanged.
pub logo: Option<Option<String>>,
pub logo_position: Option<domain::LogoPosition>,
pub logo_opacity: Option<f32>,
}
#[derive(Debug, Serialize)]
@@ -89,6 +93,9 @@ pub struct ChannelResponse {
pub recycle_policy: domain::RecyclePolicy,
pub auto_schedule: bool,
pub access_mode: domain::AccessMode,
pub logo: Option<String>,
pub logo_position: domain::LogoPosition,
pub logo_opacity: f32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
@@ -105,6 +112,9 @@ impl From<domain::Channel> for ChannelResponse {
recycle_policy: c.recycle_policy,
auto_schedule: c.auto_schedule,
access_mode: c.access_mode,
logo: c.logo,
logo_position: c.logo_position,
logo_opacity: c.logo_opacity,
created_at: c.created_at,
updated_at: c.updated_at,
}

View File

@@ -101,6 +101,15 @@ pub(super) async fn update_channel(
channel.access_password_hash = Some(infra::auth::hash_password(&pw));
}
}
if let Some(logo) = payload.logo {
channel.logo = logo;
}
if let Some(pos) = payload.logo_position {
channel.logo_position = pos;
}
if let Some(opacity) = payload.logo_opacity {
channel.logo_opacity = opacity.clamp(0.0, 1.0);
}
channel.updated_at = Utc::now();
let channel = state.channel_service.update(channel).await?;