38 lines
864 B
Go
38 lines
864 B
Go
package api
|
|
|
|
import "gitrepo.ru/neonxp/nquest/pkg/models"
|
|
|
|
var MapTeamRole = map[models.Role]UserTeamRole{
|
|
models.Captain: Captain,
|
|
models.Member: Member,
|
|
}
|
|
var MapTeamRoleReverse = map[UserTeamRole]models.Role{
|
|
Captain: models.Captain,
|
|
Member: models.Member,
|
|
}
|
|
|
|
var MapUserRole = map[models.UserRole]UserRole{
|
|
models.RoleNotVerified: NotVerified,
|
|
models.RoleUser: User,
|
|
models.RoleCreator: Creator,
|
|
models.RoleAdmin: Admin,
|
|
}
|
|
|
|
var MapUserRoleReverse = map[UserRole]models.UserRole{
|
|
NotVerified: models.RoleNotVerified,
|
|
User: models.RoleUser,
|
|
Creator: models.RoleCreator,
|
|
Admin: models.RoleAdmin,
|
|
}
|
|
|
|
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: MapTeamRole[team.Role],
|
|
}
|
|
}
|