feat: update user response
This commit is contained in:
parent
5c5b97856e
commit
8e8bd97485
|
|
@ -2,11 +2,18 @@ package mapper
|
|||
|
||||
import (
|
||||
"go-humas-be/app/database/entity"
|
||||
userLevelsRepository "go-humas-be/app/module/user_levels/repository"
|
||||
res "go-humas-be/app/module/users/response"
|
||||
)
|
||||
|
||||
func UsersResponseMapper(usersReq *entity.Users) (usersRes *res.UsersResponse) {
|
||||
func UsersResponseMapper(usersReq *entity.Users, userLevelsRepo userLevelsRepository.UserLevelsRepository) (usersRes *res.UsersResponse) {
|
||||
if usersReq != nil {
|
||||
findUserLevel, _ := userLevelsRepo.FindOne(usersReq.UserLevelId)
|
||||
userLevelGroup := ""
|
||||
if findUserLevel != nil {
|
||||
userLevelGroup = findUserLevel.AliasName
|
||||
}
|
||||
|
||||
usersRes = &res.UsersResponse{
|
||||
ID: usersReq.ID,
|
||||
Username: usersReq.Username,
|
||||
|
|
@ -22,6 +29,7 @@ func UsersResponseMapper(usersReq *entity.Users) (usersRes *res.UsersResponse) {
|
|||
LastEducation: usersReq.LastEducation,
|
||||
KeycloakId: usersReq.KeycloakId,
|
||||
UserRoleId: usersReq.UserRoleId,
|
||||
UserLevelGroup: userLevelGroup,
|
||||
StatusId: usersReq.StatusId,
|
||||
UserLevelId: usersReq.UserLevelId,
|
||||
CreatedById: usersReq.CreatedById,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ type UsersResponse struct {
|
|||
KeycloakId *string `json:"keycloakId"`
|
||||
UserRoleId uint `json:"userRoleId"`
|
||||
UserLevelId uint `json:"userLevelId"`
|
||||
UserLevelGroup string `json:"userLevelGroup"`
|
||||
StatusId *int `json:"statusId"`
|
||||
CreatedById *uint `json:"createdById"`
|
||||
ProfilePicturePath *string `json:"profilePicturePath"`
|
||||
|
|
|
|||
Loading…
Reference in New Issue