package user import ( "nixcn-cms/internal/exception" "nixcn-cms/service/service_user" "nixcn-cms/utils" "github.com/gin-gonic/gin" "github.com/google/uuid" ) // Info retrieves the profile information of the other user. // // @Summary Get Other User Information // @Description Fetches the complete profile data for the user associated with the provided session/token. // @Tags User // @Accept json // @Produce json // @Success 200 {object} utils.RespStatus{data=service_user.UserInfoData} "Successful profile retrieval" // @Failure 403 {object} utils.RespStatus{data=nil} "Missing User ID / Unauthorized" // @Failure 404 {object} utils.RespStatus{data=nil} "User Not Found" // @Failure 500 {object} utils.RespStatus{data=nil} "Internal Server Error (UUID Parse Failed)" // @Security ApiKeyAuth // @Router /user/info [get] func (self *UserHandler) Other(c *gin.Context) { userIdOrig := c.Param("user_id") userId, err := uuid.Parse(userIdOrig) if err != nil { errorCode := new(exception.Builder). SetStatus(exception.StatusServer). SetService(exception.ServiceUser). SetEndpoint(exception.EndpointUserServiceInfo). SetType(exception.TypeCommon). SetOriginal(exception.CommonErrorUuidParseFailed). SetError(err). Throw(c). String() utils.HttpResponse(c, 500, errorCode) return } UserInfoPayload := &service_user.UserInfoPayload{ Context: c, UserId: userId, IsOther: true, Data: nil, } result := self.svc.GetUserInfo(UserInfoPayload) if result.Common.Exception.Original != exception.CommonSuccess { utils.HttpResponse(c, result.Common.HttpCode, result.Common.Exception.String()) return } utils.HttpResponse(c, result.Common.HttpCode, result.Common.Exception.String(), result.Data) }