generated from VLADIMIR/template
41 lines
956 B
Go
41 lines
956 B
Go
package app
|
|
|
|
import (
|
|
"evening_detective_server/internal/services/game_service"
|
|
"evening_detective_server/proto"
|
|
)
|
|
|
|
func mapTeam(
|
|
o *game_service.Team,
|
|
) *proto.Team {
|
|
return &proto.Team{
|
|
Id: int32(o.ID),
|
|
Name: o.Name,
|
|
Status: o.Status,
|
|
Password: o.Password,
|
|
ActionsCount: int32(o.ActionsCount),
|
|
Applications: mapApplications(o.Applications),
|
|
}
|
|
}
|
|
|
|
func mapTeamDetails(o *game_service.Team) *proto.Team {
|
|
team := mapTeam(o)
|
|
team.ParticipationStatus = o.ParticipationStatus
|
|
team.ParticipationSource = o.ParticipationSource
|
|
team.ParticipationEmailError = o.ParticipationEmailError
|
|
team.ParticipationEmailSent = o.ParticipationEmailSent
|
|
team.CaptainEmail = o.CaptainEmail
|
|
team.ParticipantsCount = o.ParticipantsCount
|
|
return team
|
|
}
|
|
|
|
func mapTeams(
|
|
o []*game_service.Team,
|
|
) []*proto.Team {
|
|
res := make([]*proto.Team, 0, len(o))
|
|
for _, item := range o {
|
|
res = append(res, mapTeam(item))
|
|
}
|
|
return res
|
|
}
|