diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-05 02:27:53 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-05 03:02:18 +0900 |
| commit | 5988360d8cf0fc0028c6db1c82afc1e313ba0513 (patch) | |
| tree | 08b9e5126ff2256c64e097c5bfb1024278e33981 /backend | |
| parent | 2705f09f5c52b25af07a1d7ccec546de68ff32e9 (diff) | |
| download | iosdc-japan-2024-albatross-5988360d8cf0fc0028c6db1c82afc1e313ba0513.tar.gz iosdc-japan-2024-albatross-5988360d8cf0fc0028c6db1c82afc1e313ba0513.tar.zst iosdc-japan-2024-albatross-5988360d8cf0fc0028c6db1c82afc1e313ba0513.zip | |
feat(backend): return `game_type` in API response
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/api/generated.go | 72 | ||||
| -rw-r--r-- | backend/api/handlers.go | 2 | ||||
| -rw-r--r-- | backend/game/models.go | 1 |
3 files changed, 44 insertions, 31 deletions
diff --git a/backend/api/generated.go b/backend/api/generated.go index ea1c315..e371c7d 100644 --- a/backend/api/generated.go +++ b/backend/api/generated.go @@ -22,6 +22,12 @@ import ( strictecho "github.com/oapi-codegen/runtime/strictmiddleware/echo" ) +// Defines values for GameGameType. +const ( + Multiplayer GameGameType = "multiplayer" + N1V1 GameGameType = "1v1" +) + // Defines values for GameState. const ( Closed GameState = "closed" @@ -50,14 +56,18 @@ type Error struct { // Game defines model for Game. type Game struct { - DisplayName string `json:"display_name"` - DurationSeconds int `json:"duration_seconds"` - GameID int `json:"game_id"` - Problem *Problem `json:"problem,omitempty"` - StartedAt *int `json:"started_at,omitempty"` - State GameState `json:"state"` + DisplayName string `json:"display_name"` + DurationSeconds int `json:"duration_seconds"` + GameID int `json:"game_id"` + GameType GameGameType `json:"game_type"` + Problem *Problem `json:"problem,omitempty"` + StartedAt *int `json:"started_at,omitempty"` + State GameState `json:"state"` } +// GameGameType defines model for Game.GameType. +type GameGameType string + // GameState defines model for Game.State. type GameState string @@ -1091,31 +1101,31 @@ func (sh *strictHandler) GetToken(ctx echo.Context, params GetTokenParams) error // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/9xZX2/bNhD/Kho3oBvA+V+CovNbmrVZh64z6hZ7KAKDls42M4lUSSqJF+i7DyRlybRo", - "S3aUrFgfCtvk3f149+Pd5fiAQp6knAFTEo0fUEoESUCBMN9WQCIQM5KpFRf0H6IoZ/p3ytC4WEQYMZIA", - "GqMLZxdGAr5mVECExkpkgJEMV5AQLa7WqRaQSlC2RHmOUUrUarYkCcxoVBrQP1bqN6stFFOmYAkC5Vq1", - "AJlyJsEc6DWJPsLXDKTS30LOFDDzkaRpTEMDvX8j7SkrvT8IWKAx+r5fOatvV2X/jRC8MBWBDAVNrZe0", - "rUAUxnKM3nIxp1EE7OktV6ZyjD5w9ZZnLHp6sx+4ChbGVI7RZ7ZhDTyDaceaXi4ktEIrpLkteApCUUuF", - "BKQkS9Af4Z4kaayZ847dkphWccMerlb0+1IquS438vkNhCbgV4a3u2YjKtOYrGesWK1s6/3BsG4SoygT", - "xlszCSFnkXTkzl4OcI34GG1dpnLr0LcxFXweQ9Lk+kmxTftWEaEgmhHlaP/l/OXLV+evBl44UhFlz8uy", - "RHsujLkEfZvvCFWULWfAlNA+qn4xdpBGCCkRgArL2inmfPbDgjIqVxDpGFTOLNUfjl+VVCxA7MbH4/p9", - "kZ7EZA3ij4pUnMGfCzT+ctitNdHp6BLl+Eihy9EU5dc+JHrldDCXo+kbpsT6JEQfgUSnSV7yCE4SnGbz", - "hKr9rjCK61eSqMbMs0/bhKxjTkzGs7QwmU6XF5Sa7eNwJMehttvERbOKLZpWLNuBUDtXWJy2uhWpoEz9", - "+OI3iGOOgzsu4ui7Fz81IjOK2kKyhKmBOeAdMBKt3NMWhOXeMSCEkegURMHGzvhm9bVjnLS2n4JzLoxv", - "gXU6Zz4q406KCnN0zpmOLqemSp0i+eYewo8gs3hfxnL3dMMjR2czl+QoHMM9hMJi6JxP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FuYtbpuQS761v5DbIGo7wz19oiuvE5oI96E5i8sg82J", + "fa0tqxvba6fao+t3Tbx7Ea6Jdm42a5Ku+u1WfzIjneoOMPLOrNeU7K3pPAiix/PfzzdUh1/D+3WilPMP", + "tw2HcthfkjodsLup6vmE7QCoXqm7ht7/705jpSEEzm16NaxjqV0UkcW/1jjvUmrv2C/Vl3g6J+KRB5Rb", + "X0eS9XdEHYbxrGfUrGow9kK6O3bcpcGnDREeER72iu6ieUDWaTtIIqO9ipejcg0J3R2O4ZnRZI9MXU5/", + "FsCPGVj+zjbU+5WBy1MSMLrQA3xLZEhivAYxvGEbOrhJ1k5RscBhTOz4rnAkqs2/ZCwCrMfbqXCUl8mZ", + "K6Jqad0LBaU1noWVHSW1mV6Jux5bpY7QFdPDApNXdBEtseRMCE9B5BRH3h0svYvZO+SjW+DCTLZHg/Fg", + "pNCzBChOCJqis8FoMELm0kSnaLjGsUnWGvR2UPnT88V3IZqiK5BXeoFvXe80NETVkqHz+ie73rtTmYxG", + "Rw34bXqV0ImEWHSpVlVBQphzvHVOYkVDFuxrg/dESI+tPCOR+eh8NG6CUPo8tC8blNBZu9DOnYw6SNI4", + "xnxbQMjtZ36eyuFDPk3O2pLaU079Vjnrhu4JONAt845Md0r0hQ7xs2VYSZy3S5RXczYlrkB6OAesKBGx", + "tamGCRMOJsyYkO/1EhMcEPI1M2PKE/ORYCHuGA/3+u386Xhy5irbj6yutCBzbtqdVfvqN+uVhZL9DXuH", + "+r36G+z8b+9ztJIulJybdnSVRtHWU3QDKhXUgnFH09TikDrLPUMczaHSuaZi8kkv+BZPiP9VXszeFhvG", + "5c8RuYXQw9qcZwBmWZb9GwAA//9z5sw+kyEAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/backend/api/handlers.go b/backend/api/handlers.go index a824f17..659e5c1 100644 --- a/backend/api/handlers.go +++ b/backend/api/handlers.go @@ -87,6 +87,7 @@ func (h *ApiHandler) GetGames(ctx context.Context, request GetGamesRequestObject } games[i] = Game{ GameID: int(row.GameID), + GameType: GameGameType(row.GameType), State: GameState(row.State), DisplayName: row.DisplayName, DurationSeconds: int(row.DurationSeconds), @@ -134,6 +135,7 @@ func (h *ApiHandler) GetGame(ctx context.Context, request GetGameRequestObject, } game := Game{ GameID: int(row.GameID), + GameType: GameGameType(row.GameType), State: GameState(row.State), DisplayName: row.DisplayName, DurationSeconds: int(row.DurationSeconds), diff --git a/backend/game/models.go b/backend/game/models.go index 6c299d6..d3d0980 100644 --- a/backend/game/models.go +++ b/backend/game/models.go @@ -20,6 +20,7 @@ const ( type game struct { gameID int + gameType string state gameState displayName string durationSeconds int |
