Add Notification Filters for Seen and Priority
- Introduced new optional fields in the SearchForm for filtering notifications by 'seen' status and 'priority', enhancing the flexibility of notification retrieval. - Updated the GetNotifications method in the notification service to accommodate the new filters, ensuring they are included in the query parameters. - Enhanced the notification client to support the new filters in API requests, improving the overall functionality of the notification system. - Updated API documentation with Swagger comments to reflect the new query parameters, ensuring clarity for API consumers.
This commit is contained in:
@@ -26,6 +26,8 @@ type SearchForm struct {
|
||||
EventType string `query:"event_type" valid:"optional"`
|
||||
Type string `query:"type" valid:"optional"`
|
||||
Recipient string `query:"recipient" valid:"optional"`
|
||||
Seen *bool `query:"seen" valid:"optional"`
|
||||
Priority string `query:"priority" valid:"optional"`
|
||||
}
|
||||
|
||||
type NotificationListResponse struct {
|
||||
|
||||
@@ -64,6 +64,8 @@ func (h *NotificationHandler) Send(c echo.Context) error {
|
||||
// @Param event_type query string false "Event type filter"
|
||||
// @Param type query string false "Type filter"
|
||||
// @Param recipient query string false "Recipient filter"
|
||||
// @Param seen query bool false "Seen filter"
|
||||
// @Param priority query string false "Priority filter"
|
||||
// @Param limit query int false "Limit results"
|
||||
// @Param offset query int false "Offset results"
|
||||
// @Param sort_by query string false "Sort field"
|
||||
@@ -108,6 +110,8 @@ func (h *NotificationHandler) GetNotifications(c echo.Context) error {
|
||||
// @Param event_type query string false "Event type filter"
|
||||
// @Param type query string false "Type filter"
|
||||
// @Param recipient query string false "Recipient filter"
|
||||
// @Param seen query bool false "Seen filter"
|
||||
// @Param priority query string false "Priority filter"
|
||||
// @Param limit query int false "Limit results"
|
||||
// @Param offset query int false "Offset results"
|
||||
// @Param sort_by query string false "Sort field"
|
||||
@@ -219,6 +223,8 @@ func (h *NotificationHandler) ViewNotification(c echo.Context) error {
|
||||
// @Param event_type query string false "Event type filter"
|
||||
// @Param type query string false "Type filter"
|
||||
// @Param recipient query string false "Recipient filter"
|
||||
// @Param seen query bool false "Seen filter"
|
||||
// @Param priority query string false "Priority filter"
|
||||
// @Param limit query int false "Limit results"
|
||||
// @Param offset query int false "Offset results"
|
||||
// @Param sort_by query string false "Sort field"
|
||||
|
||||
@@ -165,6 +165,8 @@ func (s *notificationService) GetNotifications(ctx context.Context, req *SearchF
|
||||
"event_type": req.EventType,
|
||||
"type": req.Type,
|
||||
"recipient": req.Recipient,
|
||||
"seen": req.Seen,
|
||||
"priority": req.Priority,
|
||||
"limit": pagination.Limit,
|
||||
"offset": pagination.Offset,
|
||||
})
|
||||
@@ -175,6 +177,8 @@ func (s *notificationService) GetNotifications(ctx context.Context, req *SearchF
|
||||
EventType: req.EventType,
|
||||
Type: req.Type,
|
||||
UserID: req.Recipient,
|
||||
Seen: req.Seen,
|
||||
Priority: req.Priority,
|
||||
PerPage: pagination.Limit,
|
||||
Page: pagination.Offset / pagination.Limit,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user