@@ -39,14 +39,14 @@ type UserInfoData struct {
|
||||
}
|
||||
|
||||
type UserInfoPayload struct {
|
||||
Context *context.Context
|
||||
UserId *uuid.UUID
|
||||
Context context.Context
|
||||
UserId uuid.UUID
|
||||
Data *UserInfoData
|
||||
}
|
||||
|
||||
type UserInfoResult struct {
|
||||
*CommonResult
|
||||
Data *UserInfoData
|
||||
Common CommonResult
|
||||
Data *UserInfoData
|
||||
}
|
||||
|
||||
// GetUserInfo
|
||||
@@ -56,7 +56,7 @@ func (self *UserServiceImpl) GetUserInfo(payload *UserInfoPayload) (result *User
|
||||
userData, err := new(data.User).
|
||||
GetByUserId(
|
||||
payload.Context,
|
||||
payload.UserId,
|
||||
&payload.UserId,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
@@ -70,7 +70,7 @@ func (self *UserServiceImpl) GetUserInfo(payload *UserInfoPayload) (result *User
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 404,
|
||||
Exception: exception,
|
||||
},
|
||||
@@ -90,7 +90,7 @@ func (self *UserServiceImpl) GetUserInfo(payload *UserInfoPayload) (result *User
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 200,
|
||||
Exception: exception,
|
||||
},
|
||||
@@ -130,10 +130,11 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
SetOriginal(exception.CommonErrorInvalidInput)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: execption,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -150,10 +151,11 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
SetOriginal(exception.CommonErrorInvalidInput)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: execption,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -173,10 +175,11 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: execption,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -197,10 +200,11 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: execption,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -220,10 +224,11 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: execption,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -231,7 +236,7 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
userData.Bio = payload.Data.Bio
|
||||
}
|
||||
|
||||
err = userData.UpdateByUserID(payload.Context, payload.UserId)
|
||||
err = userData.UpdateByUserID(payload.Context, &payload.UserId)
|
||||
if err != nil {
|
||||
exception := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
@@ -243,10 +248,11 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -262,7 +268,7 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 200,
|
||||
Exception: exception,
|
||||
},
|
||||
@@ -273,7 +279,7 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
}
|
||||
|
||||
type UserListPayload struct {
|
||||
Context *context.Context
|
||||
Context context.Context
|
||||
Limit *string
|
||||
LimitStatus *bool
|
||||
Offset *string
|
||||
@@ -281,8 +287,8 @@ type UserListPayload struct {
|
||||
}
|
||||
|
||||
type UserListResult struct {
|
||||
*CommonResult
|
||||
UserList *[]data.UserSearchDoc `json:"user_list"`
|
||||
Common CommonResult
|
||||
Data *[]data.UserSearchDoc `json:"user_list"`
|
||||
}
|
||||
|
||||
// ListUsers
|
||||
@@ -304,11 +310,11 @@ func (self *UserServiceImpl) ListUsers(payload *UserListPayload) (result *UserLi
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserListResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
},
|
||||
UserList: nil,
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -329,11 +335,11 @@ func (self *UserServiceImpl) ListUsers(payload *UserListPayload) (result *UserLi
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserListResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: exception,
|
||||
},
|
||||
UserList: nil,
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -351,11 +357,11 @@ func (self *UserServiceImpl) ListUsers(payload *UserListPayload) (result *UserLi
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserListResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 400,
|
||||
Exception: exception,
|
||||
},
|
||||
UserList: nil,
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -375,11 +381,11 @@ func (self *UserServiceImpl) ListUsers(payload *UserListPayload) (result *UserLi
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserListResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
},
|
||||
UserList: nil,
|
||||
Data: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,11 +399,11 @@ func (self *UserServiceImpl) ListUsers(payload *UserListPayload) (result *UserLi
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserListResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 200,
|
||||
Exception: exception,
|
||||
},
|
||||
UserList: userList,
|
||||
Data: userList,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -405,12 +411,12 @@ func (self *UserServiceImpl) ListUsers(payload *UserListPayload) (result *UserLi
|
||||
}
|
||||
|
||||
type UserTablePayload struct {
|
||||
Context *context.Context
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
type UserTableResult struct {
|
||||
*CommonResult
|
||||
UserTable *[]data.User `json:"user_table"`
|
||||
Common CommonResult
|
||||
Data *[]data.User `json:"user_table"`
|
||||
}
|
||||
|
||||
// ListUserFullTable
|
||||
@@ -431,11 +437,11 @@ func (self *UserServiceImpl) GetUserFullTable(payload *UserTablePayload) (result
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserTableResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
},
|
||||
UserTable: nil,
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
@@ -451,11 +457,11 @@ func (self *UserServiceImpl) GetUserFullTable(payload *UserTablePayload) (result
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserTableResult{
|
||||
CommonResult: &CommonResult{
|
||||
Common: CommonResult{
|
||||
HttpCode: 200,
|
||||
Exception: exception,
|
||||
},
|
||||
UserTable: userFullTable,
|
||||
Data: userFullTable,
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"nixcn-cms/data"
|
||||
"nixcn-cms/internal/exception"
|
||||
"nixcn-cms/utils"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type ServiceFullResponse struct {
|
||||
}
|
||||
|
||||
func ServiceFull(ctx context.Context, userId uuid.UUID) (data *[]data.User, httpCode int, errorCode string) {
|
||||
userIdOrig, ok := c.Get("user_id")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorMissingUserId).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 403, errorCode)
|
||||
return
|
||||
}
|
||||
userId, err := uuid.Parse(userIdOrig.(string))
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
userData, err := new(data.User).GetByUserId(c, userId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUserNotFound).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 404, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
users, err := userData.GetFullTable(c)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorDatabase).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
userFullResp := struct {
|
||||
UserTable *[]data.User `json:"user_table"`
|
||||
}{users}
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceFull).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonSuccess).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 200, errorCode, userFullResp)
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"nixcn-cms/internal/exception"
|
||||
"nixcn-cms/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Info(c *gin.Context) {
|
||||
// userData := new(data.User)
|
||||
// userIdOrig, ok := c.Get("user_id")
|
||||
// if !ok {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusUser).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceInfo).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorMissingUserId).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 403, errorCode)
|
||||
// return
|
||||
// }
|
||||
// userId, err := uuid.Parse(userIdOrig.(string))
|
||||
// if err != nil {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusServer).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceInfo).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
// SetError(err).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 500, errorCode)
|
||||
// return
|
||||
// }
|
||||
|
||||
// Get user from database
|
||||
// user, err := userData.GetByUserId(c, userId)
|
||||
// if err != nil {
|
||||
// utils.HttpResponse(c, 404, errorCode)
|
||||
// return
|
||||
// }
|
||||
|
||||
userInfoResp := struct {
|
||||
}{user.UserId, user.Email, user.Username, user.Nickname, user.Subtitle, user.Avatar, user.Bio, user.PermissionLevel}
|
||||
|
||||
errorCode := new(exception.Builder).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 200, errorCode, userInfoResp)
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"nixcn-cms/data"
|
||||
"nixcn-cms/internal/exception"
|
||||
"nixcn-cms/utils"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func List(c *gin.Context) {
|
||||
// Get limit and offset from query
|
||||
limit, ok := c.GetQuery("limit")
|
||||
if !ok {
|
||||
limit = "0"
|
||||
}
|
||||
offset, ok := c.GetQuery("offset")
|
||||
if !ok {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
// Parse string to int64
|
||||
limitNum, err := strconv.ParseInt(limit, 10, 64)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
offsetNum, err := strconv.ParseInt(offset, 10, 64)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
// Get user list from search engine
|
||||
list, err := new(data.User).FastListUsers(c, limitNum, offsetNum)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeSpecific).
|
||||
SetOriginal(exception.UserListMeilisearchFailed).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
}
|
||||
|
||||
userListResp := struct {
|
||||
List *[]data.UserSearchDoc `json:"list"`
|
||||
}{list}
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceList).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonSuccess).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 200, errorCode, userListResp)
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"nixcn-cms/data"
|
||||
"nixcn-cms/internal/exception"
|
||||
"nixcn-cms/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Update(c *gin.Context) {
|
||||
// New user model
|
||||
// userIdOrig, ok := c.Get("user_id")
|
||||
// if !ok {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusUser).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorMissingUserId).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 403, errorCode)
|
||||
// return
|
||||
// }
|
||||
// userId, err := uuid.Parse(userIdOrig.(string))
|
||||
// if err != nil {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusServer).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorUuidParseFailed).
|
||||
// SetError(err).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 500, errorCode)
|
||||
// return
|
||||
// }
|
||||
|
||||
var ReqInfo data.User
|
||||
err = c.ShouldBindJSON(&ReqInfo)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorInvalidInput).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 400, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
// Get user info
|
||||
userData, err := new(data.User).GetByUserId(c, userId)
|
||||
if err != nil {
|
||||
errorCode := new(exception.Builder).
|
||||
SetStatus(exception.StatusUser).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorUserNotFound).
|
||||
SetError(err).
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 500, errorCode)
|
||||
return
|
||||
}
|
||||
|
||||
// if len(ReqInfo.Email) < 5 || len(ReqInfo.Email) >= 255 {
|
||||
// utils.HttpResponse(c, 400, "", "invilad email")
|
||||
// return
|
||||
// }
|
||||
// userData.Email = ReqInfo.Email
|
||||
|
||||
// utils.HttpResponse(c, 400, "", "invilad user name")
|
||||
// return
|
||||
|
||||
// if ReqInfo.Username != "" {
|
||||
// if len(ReqInfo.Username) < 5 || len(ReqInfo.Username) >= 255 {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusUser).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorInvalidInput).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 400, errorCode)
|
||||
// return
|
||||
// }
|
||||
// userData.Username = ReqInfo.Username
|
||||
// }
|
||||
|
||||
// if ReqInfo.Nickname != "" {
|
||||
// if utf8.RuneCountInString(ReqInfo.Nickname) > 24 {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusUser).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorInvalidInput).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 400, errorCode)
|
||||
// return
|
||||
// }
|
||||
// userData.Nickname = ReqInfo.Nickname
|
||||
// }
|
||||
|
||||
// if ReqInfo.Subtitle != "" {
|
||||
// if utf8.RuneCountInString(ReqInfo.Subtitle) > 32 {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusUser).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorInvalidInput).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 400, errorCode)
|
||||
// return
|
||||
// }
|
||||
// userData.Subtitle = ReqInfo.Subtitle
|
||||
// }
|
||||
|
||||
// if ReqInfo.Avatar != "" {
|
||||
// _, err := url.ParseRequestURI(ReqInfo.Avatar)
|
||||
// if err != nil {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusUser).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorInvalidInput).
|
||||
// SetError(err).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 400, errorCode)
|
||||
// return
|
||||
// }
|
||||
// userData.Avatar = ReqInfo.Avatar
|
||||
// }
|
||||
|
||||
// if ReqInfo.Bio != "" {
|
||||
// if !cryptography.IsBase64Std(ReqInfo.Bio) {
|
||||
// errorCode := new(exception.Builder).
|
||||
// SetStatus(exception.StatusUser).
|
||||
// SetService(exception.ServiceUser).
|
||||
// SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
// SetType(exception.TypeCommon).
|
||||
// SetOriginal(exception.CommonErrorInvalidInput).
|
||||
// Build(c)
|
||||
// utils.HttpResponse(c, 400, errorCode)
|
||||
// return
|
||||
// }
|
||||
// userData.Bio = ReqInfo.Bio
|
||||
// }
|
||||
|
||||
// Update user info
|
||||
userData.UpdateByUserID(c, userId)
|
||||
|
||||
errorCode :=
|
||||
Build(c)
|
||||
utils.HttpResponse(c, 200, errorCode)
|
||||
}
|
||||
Reference in New Issue
Block a user