application layer

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-04 01:19:59 +02:00
parent 810bad1126
commit 65bab7fd44
16 changed files with 392 additions and 31 deletions

View File

@@ -0,0 +1,23 @@
use domain::{
errors::DomainError,
models::ReviewHistory,
services::review_history::{ReviewHistoryAnalyzer, Trend},
value_objects::MovieId,
};
use crate::{context::AppContext, queries::GetReviewHistoryQuery};
pub async fn execute(
ctx: &AppContext,
query: GetReviewHistoryQuery,
) -> Result<(ReviewHistory, Trend), DomainError> {
let movie_id = MovieId::from_uuid(query.movie_id);
let mut history = ctx.repository.get_review_history(&movie_id).await?;
let trend = ReviewHistoryAnalyzer::rating_trend(&history)?;
ReviewHistoryAnalyzer::sort_chronologically(&mut history);
Ok((history, trend))
}