feat: game order api methods

This commit is contained in:
Ilia Denisov
2026-05-09 10:36:44 +02:00
parent f2a7f2b515
commit 2a1e80053a
17 changed files with 166 additions and 75 deletions
+3 -9
View File
@@ -40,23 +40,17 @@ type UserGamesOrder struct {
// UpdatedAt is the client-side timestamp used for stale-order
// detection on the engine side.
UpdatedAt int `json:"updatedAt"`
UpdatedAt int64 `json:"updatedAt"`
// Commands is the player order batch.
Commands []DecodableCommand `json:"cmd"`
}
type Order struct {
// TODO: check with already stored order, if any, and generate an error, if newer order exists
UpdatedAt int `json:"updatedAt"`
Commands []DecodableCommand `json:"cmd"`
}
func (o Order) MarshalBinary() (data []byte, err error) {
func (o UserGamesOrder) MarshalBinary() (data []byte, err error) {
return json.Marshal(&o)
}
func (o *Order) UnmarshalBinary(data []byte) error {
func (o *UserGamesOrder) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, o)
}