Refactor Notification Routes for Improved Endpoint Structure
- Updated the notification routes to enhance clarity and usability by changing the endpoint for marking notifications as seen. - Introduced a new route for marking all notifications as seen, improving the API's functionality and user experience. - Updated Swagger documentation to reflect the changes in endpoint paths, ensuring accurate API documentation for consumers.
This commit is contained in:
@@ -218,6 +218,7 @@ func RegisterPublicRoutes(e *echo.Echo, customerHandler *customer.Handler, tende
|
||||
notificationsGP.Use(customerHandler.AuthMiddleware())
|
||||
notificationsGP.GET("", notificationHandler.CustomerNotifications)
|
||||
notificationsGP.GET("/view/:id", notificationHandler.PublicViewNotification)
|
||||
notificationsGP.GET("mark-seen/:id", notificationHandler.PublicMarkSeen)
|
||||
notificationsGP.GET("mark", notificationHandler.PublicAllMarkSeen)
|
||||
notificationsGP.GET("mark/:id", notificationHandler.PublicMarkSeen)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ func (h *NotificationHandler) CustomerNotifications(c echo.Context) error {
|
||||
// @Failure 400 {object} response.APIResponse
|
||||
// @Failure 500 {object} response.APIResponse
|
||||
// @Security BearerAuth
|
||||
// @Router /api/v1/notifications/mark-seen/{id} [get]
|
||||
// @Router /api/v1/notifications/mark/{id} [get]
|
||||
func (h *NotificationHandler) PublicMarkSeen(c echo.Context) error {
|
||||
notificationID := c.Param("id")
|
||||
|
||||
@@ -306,7 +306,7 @@ func (h *NotificationHandler) PublicMarkSeen(c echo.Context) error {
|
||||
// @Failure 400 {object} response.APIResponse
|
||||
// @Failure 500 {object} response.APIResponse
|
||||
// @Security BearerAuth
|
||||
// @Router /api/v1/notifications/all-seen/{user_id} [get]
|
||||
// @Router /api/v1/notifications/mark [get]
|
||||
func (h *NotificationHandler) PublicAllMarkSeen(c echo.Context) error {
|
||||
userID, err := customer.GetCustomerIDFromContext(c)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user