application: schedule bounded context

This commit is contained in:
2026-07-12 02:02:23 +02:00
parent 6fd47f2d93
commit ef86a967cd
21 changed files with 608 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
use chrono::Utc;
use domain::models::GeneratedSchedule;
use domain::value_objects::ChannelId;
use domain::DomainResult;
use super::deps::ScheduleDeps;
use super::queries::GetActiveScheduleQuery;
/// Fetch the schedule currently active at `now`.
///
/// Returns `None` when no schedule covers the current time.
pub async fn execute(
deps: &ScheduleDeps,
query: GetActiveScheduleQuery,
) -> DomainResult<Option<GeneratedSchedule>> {
let channel_id = ChannelId::from(query.channel_id);
deps.schedule_query.find_active(channel_id, Utc::now()).await
}
#[cfg(test)]
#[path = "tests/get_active.rs"]
mod tests;