From 52ba0aea4245686bb492e53c2996f37202c46b0c Mon Sep 17 00:00:00 2001 From: efrilm Date: Thu, 2 Oct 2025 19:47:44 +0700 Subject: [PATCH] update user --- internal/handler/user_handler.go | 2 +- internal/router/health_handler.go | 2 ++ internal/router/router.go | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/handler/user_handler.go b/internal/handler/user_handler.go index 75de6ea..e5c8752 100644 --- a/internal/handler/user_handler.go +++ b/internal/handler/user_handler.go @@ -89,7 +89,7 @@ func (h *UserHandler) UpdateUser(c *gin.Context) { } logger.FromContext(c).Infof("UserHandler::UpdateUser -> Successfully updated user = %+v", userResponse) - c.JSON(http.StatusOK, userResponse) + c.JSON(http.StatusOK, contract.BuildSuccessResponse(userResponse)) } func (h *UserHandler) DeleteUser(c *gin.Context) { diff --git a/internal/router/health_handler.go b/internal/router/health_handler.go index 9ae7404..9c4393a 100644 --- a/internal/router/health_handler.go +++ b/internal/router/health_handler.go @@ -9,12 +9,14 @@ type HealthHandler interface { type UserHandler interface { ListUsers(c *gin.Context) CreateUser(c *gin.Context) + UpdateUser(c *gin.Context) GetProfile(c *gin.Context) GetUserProfile(c *gin.Context) UpdateProfile(c *gin.Context) ChangePassword(c *gin.Context) ListTitles(c *gin.Context) GetActiveUsersForMention(c *gin.Context) + } type FileHandler interface { diff --git a/internal/router/router.go b/internal/router/router.go index 4591b38..8d121bb 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -94,6 +94,7 @@ func (r *Router) addAppRoutes(rg *gin.Engine) { { users.POST("", r.userHandler.CreateUser) users.GET("", r.userHandler.ListUsers) + users.PUT("/:id", r.userHandler.UpdateUser) users.GET("/profile", r.userHandler.GetProfile) users.GET("/:id/profile", r.userHandler.GetUserProfile) users.PUT("/profile", r.userHandler.UpdateProfile)