mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-20 22:06:31 +00:00
21 lines
461 B
Go
21 lines
461 B
Go
|
package mappers
|
||
|
|
||
|
import (
|
||
|
"github.com/hay-kot/content/backend/ent"
|
||
|
"github.com/hay-kot/content/backend/internal/types"
|
||
|
)
|
||
|
|
||
|
func ToOutUser(user *ent.User, err error) (*types.UserOut, error) {
|
||
|
if err != nil {
|
||
|
return &types.UserOut{}, err
|
||
|
}
|
||
|
return &types.UserOut{
|
||
|
ID: user.ID,
|
||
|
Name: user.Name,
|
||
|
Email: user.Email,
|
||
|
IsSuperuser: user.IsSuperuser,
|
||
|
GroupName: user.Edges.Group.Name,
|
||
|
GroupID: user.Edges.Group.ID,
|
||
|
}, nil
|
||
|
}
|