74 lines
2.3 KiB
Go
74 lines
2.3 KiB
Go
package gamemanagement
|
|
|
|
import gamev1 "hyapp.local/api/proto/game/v1"
|
|
|
|
type platformDTO struct {
|
|
AppCode string `json:"appCode"`
|
|
PlatformCode string `json:"platformCode"`
|
|
PlatformName string `json:"platformName"`
|
|
Status string `json:"status"`
|
|
APIBaseURL string `json:"apiBaseUrl"`
|
|
SortOrder int32 `json:"sortOrder"`
|
|
CreatedAtMS int64 `json:"createdAtMs"`
|
|
UpdatedAtMS int64 `json:"updatedAtMs"`
|
|
}
|
|
|
|
type catalogDTO struct {
|
|
AppCode string `json:"appCode"`
|
|
GameID string `json:"gameId"`
|
|
PlatformCode string `json:"platformCode"`
|
|
ProviderGameID string `json:"providerGameId"`
|
|
GameName string `json:"gameName"`
|
|
Category string `json:"category"`
|
|
IconURL string `json:"iconUrl"`
|
|
CoverURL string `json:"coverUrl"`
|
|
LaunchMode string `json:"launchMode"`
|
|
Orientation string `json:"orientation"`
|
|
MinCoin int64 `json:"minCoin"`
|
|
Status string `json:"status"`
|
|
SortOrder int32 `json:"sortOrder"`
|
|
Tags []string `json:"tags"`
|
|
CreatedAtMS int64 `json:"createdAtMs"`
|
|
UpdatedAtMS int64 `json:"updatedAtMs"`
|
|
}
|
|
|
|
func platformFromProto(item *gamev1.GamePlatform) platformDTO {
|
|
if item == nil {
|
|
return platformDTO{}
|
|
}
|
|
return platformDTO{
|
|
AppCode: item.GetAppCode(),
|
|
PlatformCode: item.GetPlatformCode(),
|
|
PlatformName: item.GetPlatformName(),
|
|
Status: item.GetStatus(),
|
|
APIBaseURL: item.GetApiBaseUrl(),
|
|
SortOrder: item.GetSortOrder(),
|
|
CreatedAtMS: item.GetCreatedAtMs(),
|
|
UpdatedAtMS: item.GetUpdatedAtMs(),
|
|
}
|
|
}
|
|
|
|
func catalogFromProto(item *gamev1.GameCatalogItem) catalogDTO {
|
|
if item == nil {
|
|
return catalogDTO{}
|
|
}
|
|
return catalogDTO{
|
|
AppCode: item.GetAppCode(),
|
|
GameID: item.GetGameId(),
|
|
PlatformCode: item.GetPlatformCode(),
|
|
ProviderGameID: item.GetProviderGameId(),
|
|
GameName: item.GetGameName(),
|
|
Category: item.GetCategory(),
|
|
IconURL: item.GetIconUrl(),
|
|
CoverURL: item.GetCoverUrl(),
|
|
LaunchMode: item.GetLaunchMode(),
|
|
Orientation: item.GetOrientation(),
|
|
MinCoin: item.GetMinCoin(),
|
|
Status: item.GetStatus(),
|
|
SortOrder: item.GetSortOrder(),
|
|
Tags: item.GetTags(),
|
|
CreatedAtMS: item.GetCreatedAtMs(),
|
|
UpdatedAtMS: item.GetUpdatedAtMs(),
|
|
}
|
|
}
|