refactor(wrapup): scoped deps — HandleWrapUpRequestedDeps, flat-Arc jobs
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use domain::errors::DomainError;
|
||||
use domain::ports::WrapUpRepository;
|
||||
use domain::value_objects::WrapUpId;
|
||||
|
||||
use crate::context::AppContext;
|
||||
|
||||
pub async fn execute(ctx: &AppContext, id: WrapUpId) -> Result<(), DomainError> {
|
||||
ctx.repos
|
||||
.wrapup_repo
|
||||
pub async fn execute(
|
||||
wrapup_repo: Arc<dyn WrapUpRepository>,
|
||||
id: WrapUpId,
|
||||
) -> Result<(), DomainError> {
|
||||
wrapup_repo
|
||||
.get_by_id(&id)
|
||||
.await?
|
||||
.ok_or_else(|| DomainError::NotFound("wrap-up not found".into()))?;
|
||||
|
||||
ctx.repos.wrapup_repo.delete(&id).await
|
||||
wrapup_repo.delete(&id).await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user