pub struct NotificationUseCases { /* private fields */ }Implementations§
Source§impl NotificationUseCases
impl NotificationUseCases
pub fn new( notification_repository: Arc<dyn NotificationRepository>, preference_repository: Arc<dyn NotificationPreferenceRepository>, ) -> Self
Sourcepub async fn create_notification(
&self,
organization_id: Uuid,
request: CreateNotificationRequest,
) -> Result<NotificationResponse, String>
pub async fn create_notification( &self, organization_id: Uuid, request: CreateNotificationRequest, ) -> Result<NotificationResponse, String>
Create a new notification
Sourcepub async fn get_notification(
&self,
id: Uuid,
) -> Result<Option<NotificationResponse>, String>
pub async fn get_notification( &self, id: Uuid, ) -> Result<Option<NotificationResponse>, String>
Get a notification by ID
Sourcepub async fn list_user_notifications(
&self,
user_id: Uuid,
) -> Result<Vec<NotificationResponse>, String>
pub async fn list_user_notifications( &self, user_id: Uuid, ) -> Result<Vec<NotificationResponse>, String>
List all notifications for a user
Sourcepub async fn list_unread_notifications(
&self,
user_id: Uuid,
) -> Result<Vec<NotificationResponse>, String>
pub async fn list_unread_notifications( &self, user_id: Uuid, ) -> Result<Vec<NotificationResponse>, String>
List unread in-app notifications for a user
Sourcepub async fn mark_as_read(
&self,
id: Uuid,
) -> Result<NotificationResponse, String>
pub async fn mark_as_read( &self, id: Uuid, ) -> Result<NotificationResponse, String>
Mark an in-app notification as read
Sourcepub async fn mark_all_read(&self, user_id: Uuid) -> Result<i64, String>
pub async fn mark_all_read(&self, user_id: Uuid) -> Result<i64, String>
Mark all in-app notifications as read for a user
Sourcepub async fn delete_notification(&self, id: Uuid) -> Result<bool, String>
pub async fn delete_notification(&self, id: Uuid) -> Result<bool, String>
Delete a notification
Sourcepub async fn get_user_stats(
&self,
user_id: Uuid,
) -> Result<NotificationStats, String>
pub async fn get_user_stats( &self, user_id: Uuid, ) -> Result<NotificationStats, String>
Get notification statistics for a user
Sourcepub async fn get_user_preferences(
&self,
user_id: Uuid,
) -> Result<Vec<NotificationPreferenceResponse>, String>
pub async fn get_user_preferences( &self, user_id: Uuid, ) -> Result<Vec<NotificationPreferenceResponse>, String>
Get user’s notification preferences
Sourcepub async fn get_preference(
&self,
user_id: Uuid,
notification_type: NotificationType,
) -> Result<Option<NotificationPreferenceResponse>, String>
pub async fn get_preference( &self, user_id: Uuid, notification_type: NotificationType, ) -> Result<Option<NotificationPreferenceResponse>, String>
Get user’s preference for a specific notification type
Sourcepub async fn update_preference(
&self,
user_id: Uuid,
notification_type: NotificationType,
request: UpdatePreferenceRequest,
) -> Result<NotificationPreferenceResponse, String>
pub async fn update_preference( &self, user_id: Uuid, notification_type: NotificationType, request: UpdatePreferenceRequest, ) -> Result<NotificationPreferenceResponse, String>
Update user’s notification preference for a specific notification type
Sourcepub async fn get_pending_notifications(
&self,
) -> Result<Vec<NotificationResponse>, String>
pub async fn get_pending_notifications( &self, ) -> Result<Vec<NotificationResponse>, String>
Get all pending notifications (for background processing)
Sourcepub async fn get_failed_notifications(
&self,
) -> Result<Vec<NotificationResponse>, String>
pub async fn get_failed_notifications( &self, ) -> Result<Vec<NotificationResponse>, String>
Get all failed notifications (for retry)
Sourcepub async fn mark_as_sent(
&self,
id: Uuid,
) -> Result<NotificationResponse, String>
pub async fn mark_as_sent( &self, id: Uuid, ) -> Result<NotificationResponse, String>
Mark notification as sent
Sourcepub async fn mark_as_failed(
&self,
id: Uuid,
error_message: String,
) -> Result<NotificationResponse, String>
pub async fn mark_as_failed( &self, id: Uuid, error_message: String, ) -> Result<NotificationResponse, String>
Mark notification as failed
Sourcepub async fn retry_notification(
&self,
id: Uuid,
) -> Result<NotificationResponse, String>
pub async fn retry_notification( &self, id: Uuid, ) -> Result<NotificationResponse, String>
Retry a failed notification
Auto Trait Implementations§
impl Freeze for NotificationUseCases
impl !RefUnwindSafe for NotificationUseCases
impl Send for NotificationUseCases
impl Sync for NotificationUseCases
impl Unpin for NotificationUseCases
impl !UnwindSafe for NotificationUseCases
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.