Enhance notification system with in-app delivery support
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
- Added `DeliveryChannelInApp` to support in-app notifications. - Introduced `EventTypeInApp` constant for identifying in-app notifications. - Updated `AdminNotifications` and `CustomerNotifications` handlers to set the event type to `EventTypeInApp`. - Modified the `GetByUserID` repository method to handle filtering for in-app notifications, allowing for more flexible retrieval options. - Updated the `persistNotification` method to include in-app as a delivery method. This update improves the notification system by enabling in-app notifications, enhancing user engagement and notification management capabilities.
This commit is contained in:
@@ -149,7 +149,9 @@ func (s *notificationService) sendToRecipient(ctx context.Context, recipient not
|
||||
}
|
||||
|
||||
func (s *notificationService) persistNotification(ctx context.Context, recipient notificationRecipient, req *NotificationRequest, link, image string) error {
|
||||
methods := make(map[string]string)
|
||||
methods := map[string]string{
|
||||
"in_app": "true",
|
||||
}
|
||||
if slices.Contains(req.Channels, DeliveryChannelEmail) && recipient.Email != "" {
|
||||
methods["email"] = recipient.Email
|
||||
}
|
||||
@@ -170,6 +172,7 @@ func (s *notificationService) persistNotification(ctx context.Context, recipient
|
||||
Image: image,
|
||||
Priority: string(req.Priority),
|
||||
Type: string(req.Type),
|
||||
EventType: EventTypeInApp,
|
||||
Status: status,
|
||||
Methods: methods,
|
||||
Metadata: map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user