From e1ae090ff911237e59919d824e01c02cfde82537 Mon Sep 17 00:00:00 2001 From: "n.nakhostin" Date: Tue, 23 Sep 2025 10:33:17 +0330 Subject: [PATCH] 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. --- cmd/web/router/routes.go | 3 ++- internal/notification/handler.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/web/router/routes.go b/cmd/web/router/routes.go index c5528db..2d276cf 100644 --- a/cmd/web/router/routes.go +++ b/cmd/web/router/routes.go @@ -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) } } diff --git a/internal/notification/handler.go b/internal/notification/handler.go index c8761c2..d2f2f78 100644 --- a/internal/notification/handler.go +++ b/internal/notification/handler.go @@ -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 {