This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
use domain::{errors::DomainError, value_objects::{ImportProfileId, UserId}};
|
||||
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?
|
||||
.get(&profile_id, &user_id)
|
||||
.await?
|
||||
.ok_or_else(|| DomainError::NotFound("import profile".into()))?;
|
||||
ctx.import_profile_repository.delete(&profile_id).await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user