18
crates/application/src/push/use_cases/unsubscribe.rs
Normal file
18
crates/application/src/push/use_cases/unsubscribe.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use domain::ports::PushSubscriptionCommandPort;
|
||||
|
||||
use crate::errors::ApplicationError;
|
||||
|
||||
use super::super::commands::UnsubscribePushCommand;
|
||||
|
||||
pub struct Deps {
|
||||
pub push_command: Arc<dyn PushSubscriptionCommandPort>,
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(deps))]
|
||||
pub async fn execute(cmd: UnsubscribePushCommand, deps: &Deps) -> Result<(), ApplicationError> {
|
||||
deps.push_command.delete_by_endpoint(&cmd.endpoint).await?;
|
||||
tracing::info!(endpoint = cmd.endpoint, "push subscription removed");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user