Files
public-api/pkg/api/dto/map.go
Rhys Lloyd b98b184a32 switch maps queries to maps_extended
times continues to use the embedded map
2025-07-25 20:38:50 -07:00

30 lines
621 B
Go

package dto
import (
"git.itzana.me/strafesnet/go-grpc/maps"
"time"
)
type Map struct {
ID int64 `json:"id"`
DisplayName string `json:"display_name"`
Creator string `json:"creator"`
GameID int32 `json:"game_id"`
Date time.Time `json:"date"`
} // @name Map
// FromGRPC converts a maps.MapResponse protobuf message to a Map domain object
func (m *Map) FromGRPC(resp *maps.MapResponse) *Map {
if resp == nil {
return nil
}
m.ID = resp.ID
m.DisplayName = resp.DisplayName
m.Creator = resp.Creator
m.Date = time.Unix(resp.Date, 0)
m.GameID = resp.GameID
return m
}