Files
2026-07-26 22:38:33 +07:00

33 lines
651 B
Go

package app
import (
"evening_detective_server/internal/services/game_service"
"evening_detective_server/proto"
"google.golang.org/protobuf/types/known/timestamppb"
)
func mapGame(
o *game_service.Game,
) *proto.Game {
return &proto.Game{
Id: int32(o.ID),
Name: o.Name,
Description: o.Description,
StartAt: timestamppb.New(o.StartAt),
Status: o.Status,
Scenario: mapScenario(o.Scenario),
Teams: mapTeams(o.Teams),
}
}
func mapGames(
o []*game_service.Game,
) []*proto.Game {
res := make([]*proto.Game, 0, len(o))
for _, item := range o {
res = append(res, mapGame(item))
}
return res
}