nquest/api/mapper.go

20 lines
369 B
Go

package api
import "gitrepo.ru/neonxp/nquest/pkg/models"
var MapRole = map[models.Role]UserTeamRole{
models.Captain: Captain,
models.Member: Member,
}
func MapUserTeam(team *models.TeamMember) *UserTeam {
if team == nil || team.Team == nil {
return nil
}
return &UserTeam{
Id: int(team.Team.ID),
Name: team.Team.Name,
Role: MapRole[team.Role],
}
}