Closes #20 I'm assuming protobuf will fill Thumbnail with a default value (0) since it dosn't exist yet. Reviewed-on: #22 Reviewed-by: itzaname <itzaname@noreply@itzana.me> Co-authored-by: Rhys Lloyd <krakow20@gmail.com> Co-committed-by: Rhys Lloyd <krakow20@gmail.com>
31 lines
641 B
Go
31 lines
641 B
Go
package dto
|
|
|
|
import (
|
|
"git.itzana.me/strafesnet/go-grpc/maps"
|
|
)
|
|
|
|
type MapFilter struct {
|
|
GameID *int32 `json:"game_id" form:"game_id"`
|
|
} // @name MapFilter
|
|
|
|
type Map struct {
|
|
ID int64 `json:"id"`
|
|
DisplayName string `json:"display_name"`
|
|
GameID int32 `json:"game_id"`
|
|
Thumbnail uint64 `json:"thumbnail"`
|
|
} // @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.GameID = resp.GameID
|
|
m.Thumbnail = resp.Thumbnail
|
|
|
|
return m
|
|
}
|