Enhance notification search functionality with user ID filtering
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
- Added a new `UserID` field to the `SearchForm` to allow filtering notifications by user ID. - Implemented the `ResolvedRecipients` method to return user IDs based on the `user_id` or `recipient` query parameters, improving the flexibility of notification searches. - Updated the `GetNotifications` method in the service layer to utilize the new recipient resolution logic, ensuring accurate retrieval of notifications based on user ID. This update enhances the notification management capabilities, providing more granular control over notification searches.
This commit is contained in:
@@ -197,14 +197,14 @@ func (s *notificationService) GetNotifications(ctx context.Context, req *SearchF
|
||||
"method": req.Method,
|
||||
"event_type": req.EventType,
|
||||
"type": req.Type,
|
||||
"recipient": req.Recipient,
|
||||
"recipient": req.ResolvedRecipients(),
|
||||
"seen": req.Seen,
|
||||
"priority": req.Priority,
|
||||
"limit": pagination.Limit,
|
||||
"offset": pagination.Offset,
|
||||
})
|
||||
|
||||
page, err := s.repository.GetByUserID(ctx, req.Recipient, search, req.Status, req.Seen, req.Priority, req.EventType, req.Type, pagination)
|
||||
page, err := s.repository.GetByUserID(ctx, req.ResolvedRecipients(), search, req.Status, req.Seen, req.Priority, req.EventType, req.Type, pagination)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to get notifications", map[string]interface{}{
|
||||
"error": err.Error(),
|
||||
|
||||
Reference in New Issue
Block a user