2022-09-04 02:42:03 +00:00
|
|
|
package mappers
|
|
|
|
|
|
|
|
import (
|
2022-09-24 19:33:38 +00:00
|
|
|
"github.com/hay-kot/homebox/backend/ent"
|
|
|
|
"github.com/hay-kot/homebox/backend/internal/types"
|
2022-09-04 02:42:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|