UPDATE: Change type response
All checks were successful
Build and Release / release (push) Successful in 1m7s

This commit is contained in:
2026-04-16 12:39:05 +07:00
parent 822a92d1cc
commit 5c363589d8
11 changed files with 336 additions and 69 deletions

View File

@@ -20,9 +20,26 @@ type UserEntity struct {
UpdatedAt *time.Time `json:"updated_at"`
Roles []*RoleSimple `json:"roles"`
}
type UserSimpleEntity struct {
ID string `json:"id"`
Email string `json:"email"`
DisplayName string `json:"display_name"`
FullName string `json:"full_name"`
AvatarUrl string `json:"avatar_url"`
}
func (u *UserSimpleEntity) ToResponse() *response.UserSimpleResponse {
return &response.UserSimpleResponse{
ID: u.ID,
Email: u.Email,
DisplayName: u.DisplayName,
FullName: u.FullName,
AvatarUrl: u.AvatarUrl,
}
}
func (u *UserEntity) ParseRoles(data []byte) error {
if len(data) == 0 {
if len(data) == 0 || string(data) == "null" {
u.Roles = []*RoleSimple{}
return nil
}
@@ -30,7 +47,7 @@ func (u *UserEntity) ParseRoles(data []byte) error {
}
func (u *UserEntity) ParseProfile(data []byte) error {
if len(data) == 0 {
if len(data) == 0 || string(data) == "null" {
u.Profile = &UserProfileSimple{}
return nil
}