Files
movies-diary/crates/application/src/use_cases/delete_import_profile.rs
Gabriel Kaszewski 19171806b9
Some checks failed
CI / Check / Test / Build (push) Has been cancelled
fmt
2026-05-13 23:38:57 +02:00

17 lines
599 B
Rust

use crate::{commands::DeleteImportProfileCommand, context::AppContext};
use domain::{
errors::DomainError,
value_objects::{ImportProfileId, UserId},
};
pub async fn execute(ctx: &AppContext, cmd: DeleteImportProfileCommand) -> Result<(), DomainError> {
let user_id = UserId::from_uuid(cmd.user_id);
let profile_id = ImportProfileId::from_uuid(cmd.profile_id);
ctx.import_profile_repository
.get(&profile_id, &user_id)
.await?
.ok_or_else(|| DomainError::NotFound("import profile".into()))?;
ctx.import_profile_repository.delete(&profile_id).await
}