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:
@@ -295,6 +295,33 @@ func (h *NotificationHandler) PublicMarkSeen(c echo.Context) error {
|
||||
return response.Success(c, nil, "Notification marked as seen successfully")
|
||||
}
|
||||
|
||||
// AllMarkSeen marks all notifications as seen for a user
|
||||
// @Summary Mark all notifications as seen for a user
|
||||
// @Description Mark all notifications as seen for a user
|
||||
// @Tags Notification
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param user_id path string true "User ID"
|
||||
// @Success 200 {object} response.APIResponse
|
||||
// @Failure 400 {object} response.APIResponse
|
||||
// @Failure 500 {object} response.APIResponse
|
||||
// @Security BearerAuth
|
||||
// @Router /api/v1/notifications/all-seen/{user_id} [get]
|
||||
func (h *NotificationHandler) PublicAllMarkSeen(c echo.Context) error {
|
||||
userID, err := customer.GetCustomerIDFromContext(c)
|
||||
if err != nil {
|
||||
return response.BadRequest(c, "user ID is required", "User ID must be provided")
|
||||
}
|
||||
|
||||
// Mark all notifications as seen
|
||||
err = h.service.AllMarkSeen(c.Request().Context(), userID)
|
||||
if err != nil {
|
||||
return response.InternalServerError(c, "Failed to mark all notifications as seen")
|
||||
}
|
||||
|
||||
return response.Success(c, nil, "All notifications marked as seen successfully")
|
||||
}
|
||||
|
||||
// ViewNotification gets a single notification by ID
|
||||
// @Summary Get notification details
|
||||
// @Description Get detailed information about a specific notification
|
||||
|
||||
Reference in New Issue
Block a user