Add AllMarkSeen Functionality to Notification System
- Introduced the AllMarkSeen method in the notification service to mark all notifications as seen for a user, enhancing user experience by allowing bulk actions on notifications. - Implemented the PublicAllMarkSeen handler to handle HTTP requests for marking all notifications as seen, ensuring proper request validation and response handling. - Updated the notification client and SDK to support the new AllMarkSeen functionality, improving the overall API capabilities. - Enhanced API documentation with Swagger comments for the new endpoint, ensuring clarity for API consumers.
This commit is contained in:
@@ -20,6 +20,7 @@ type Service interface {
|
||||
GetNotifications(ctx context.Context, req *SearchForm, pagination *response.Pagination) (*NotificationListResponse, error)
|
||||
GetNotification(ctx context.Context, notificationID string) (*NotificationResponse, error)
|
||||
MarkSeen(ctx context.Context, notificationID, userID string) error
|
||||
AllMarkSeen(ctx context.Context, userID string) error
|
||||
getUsers(ctx context.Context, userIDs []string) ([]notificationRecipient, error)
|
||||
getCustomers(ctx context.Context, values []string, target string) ([]notificationRecipient, error)
|
||||
}
|
||||
@@ -308,6 +309,18 @@ func (s *notificationService) MarkSeen(ctx context.Context, notificationID, user
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *notificationService) AllMarkSeen(ctx context.Context, userID string) error {
|
||||
s.logger.Info("Marking all notifications as seen", map[string]interface{}{
|
||||
"user_id": userID,
|
||||
})
|
||||
|
||||
_, err := s.sdk.AllMarkSeen(ctx, userID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *notificationService) getUsers(ctx context.Context, userIDs []string) ([]notificationRecipient, error) {
|
||||
recipients := make([]notificationRecipient, 0)
|
||||
offset := 0
|
||||
|
||||
Reference in New Issue
Block a user