@@ -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
|
||||
|
||||
Reference in New Issue
Block a user