Add attendance_list in service_event, add set user permission in user
update Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
@@ -163,7 +163,35 @@ func (self *UserServiceImpl) UpdateUserInfo(payload *UserInfoPayload) (result *U
|
||||
return
|
||||
}
|
||||
|
||||
err = new(data.User).UpdateByUserID(payload.Context, &payload.UserId, updates)
|
||||
userData := new(data.User)
|
||||
|
||||
userInfo, err := userData.GetByUserId(payload.Context, &payload.UserId)
|
||||
if err != nil {
|
||||
exception := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
SetService(exception.ServiceUser).
|
||||
SetEndpoint(exception.EndpointUserServiceUpdate).
|
||||
SetType(exception.TypeCommon).
|
||||
SetOriginal(exception.CommonErrorDatabase).
|
||||
SetError(err).
|
||||
Throw(payload.Context)
|
||||
|
||||
result = &UserInfoResult{
|
||||
Common: shared.CommonResult{
|
||||
HttpCode: 500,
|
||||
Exception: exception,
|
||||
},
|
||||
Data: nil,
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if payload.Data.PermissionLevel != nil && userInfo.PermissionLevel >= 50 {
|
||||
updates["permission_level"] = *payload.Data.PermissionLevel
|
||||
}
|
||||
|
||||
err = userData.UpdateByUserID(payload.Context, &payload.UserId, updates)
|
||||
if err != nil {
|
||||
exception := new(exception.Builder).
|
||||
SetStatus(exception.StatusServer).
|
||||
|
||||
Reference in New Issue
Block a user