application: channels bounded context

CQRS use cases (create/update/delete/get/list/list_by_owner),
ownership checks, auto-snapshot on config change.
Channel setters added to domain model.
This commit is contained in:
2026-07-12 01:57:38 +02:00
parent 2976600d12
commit 6fd47f2d93
18 changed files with 909 additions and 0 deletions

View File

@@ -194,6 +194,44 @@ impl Channel {
pub fn updated_at(&self) -> DateTime<Utc> {
self.updated_at
}
// -- Setters --
/// Update the channel name and touch `updated_at`.
pub fn set_name(&mut self, name: impl Into<String>) {
self.name = name.into();
self.updated_at = Utc::now();
}
/// Update the description and touch `updated_at`.
pub fn set_description(&mut self, description: Option<String>) {
self.description = description;
self.updated_at = Utc::now();
}
/// Update the timezone and touch `updated_at`.
pub fn set_timezone(&mut self, timezone: impl Into<String>) {
self.timezone = timezone.into();
self.updated_at = Utc::now();
}
/// Replace the schedule config and touch `updated_at`.
pub fn set_schedule_config(&mut self, config: ScheduleConfig) {
self.schedule_config = config;
self.updated_at = Utc::now();
}
/// Replace the recycle policy and touch `updated_at`.
pub fn set_recycle_policy(&mut self, policy: RecyclePolicy) {
self.recycle_policy = policy;
self.updated_at = Utc::now();
}
/// Toggle auto-schedule and touch `updated_at`.
pub fn set_auto_schedule(&mut self, enabled: bool) {
self.auto_schedule = enabled;
self.updated_at = Utc::now();
}
}
// ============================================================================