diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-12 05:54:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-12 05:54:37 +0900 |
| commit | b37d6f213c2f3b19631e5067f39a7106859faaed (patch) | |
| tree | 3c45267ee25aa78be1ad4c31e0c09894e656b506 /backend/api | |
| parent | 545d86085f927bded852dd5a8ee8341f60f24d84 (diff) | |
| download | iosdc-japan-2024-albatross-b37d6f213c2f3b19631e5067f39a7106859faaed.tar.gz iosdc-japan-2024-albatross-b37d6f213c2f3b19631e5067f39a7106859faaed.tar.zst iosdc-japan-2024-albatross-b37d6f213c2f3b19631e5067f39a7106859faaed.zip | |
feat: show left time in play page
Diffstat (limited to 'backend/api')
| -rw-r--r-- | backend/api/generated.go | 61 | ||||
| -rw-r--r-- | backend/api/handler.go | 8 |
2 files changed, 35 insertions, 34 deletions
diff --git a/backend/api/generated.go b/backend/api/generated.go index 7991f97..7eb5940 100644 --- a/backend/api/generated.go +++ b/backend/api/generated.go @@ -97,7 +97,7 @@ type Game struct { GameType GameGameType `json:"game_type"` Players []User `json:"players"` Problem Problem `json:"problem"` - StartedAt *int `json:"started_at,omitempty"` + StartedAt *int64 `json:"started_at,omitempty"` State GameState `json:"state"` } @@ -169,7 +169,7 @@ type GamePlayerMessageS2CStart struct { // GamePlayerMessageS2CStartPayload defines model for GamePlayerMessageS2CStartPayload. type GamePlayerMessageS2CStartPayload struct { - StartAt int `json:"start_at"` + StartAt int64 `json:"start_at"` } // GamePlayerMessageS2CSubmitResult defines model for GamePlayerMessageS2CSubmitResult. @@ -235,7 +235,7 @@ type GameWatcherMessageS2CStart struct { // GameWatcherMessageS2CStartPayload defines model for GameWatcherMessageS2CStartPayload. type GameWatcherMessageS2CStartPayload struct { - StartAt int `json:"start_at"` + StartAt int64 `json:"start_at"` } // GameWatcherMessageS2CSubmit defines model for GameWatcherMessageS2CSubmit. @@ -1161,33 +1161,34 @@ func (sh *strictHandler) GetToken(ctx echo.Context, params GetTokenParams) error // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+xab2/bNhP/Knr4DOgGaPGfBEXnd2nWZh26Lqhb7EURGLR0tplRpEpScbxA330gKUui", - "JVmyIwdFsb4obJF397u7H4+nnB9RwKOYM2BKoskjirHAESgQ5tsKcAhihhO14oL8gxXhTD8nDE2yReQj", - "hiNAE3Tp7PKRgK8JERCiiRIJ+EgGK4iwFlebWAtIJQhbojT1UYzVarbEEcxImBvQDwv129UOiglTsASB", - "Uq1agIw5k2Aceo3Dj/A1Aan0t4AzBcx8xHFMSWCgD+6k9bLQ+4OABZqg/w+KYA3sqhy8EYJnpkKQgSCx", - "jZK25YnMWOqjt1zMSRgCO73lwlTqow9cveUJC09v9gNX3sKYSn30mW1ZA89g2rGmlzMJrdAKaW4LHoNQ", - "xFIhAinxEvRHeMBRTDVz3rF7TEmRN7+GqwX9vuRKbvONfH4HgUn4mwcIpgriqmmK50Bdw59AKi/AErxR", - "1aiPFEilV7PjkcuNfMQSSvFcf7GnoXIGXMRlTX6GpA79tTl1u8hDImOKNzOWrRYO6P312MNEmFzPJASc", - "hdKRO385rEL2ETxAMJMKYrObKIhkKze24U5zhVgIvNHfS5WlHLqqXbPRPn5EwJJIh2x0r/2KEqqIdh6E", - "DljhuV2uuG23dsf/WVoIu9hjwecUojbxm2yb5r7CQkE4w8px+JeLly9fXbwa1gZcKqwcpwPKJWiKrDFR", - "2qVMr/24xJH9sCCMyBWEbkhy4f2npyjpRdy3UHyXazU0KkJTBNthThOtb8zmP4rzzxn8uUCTL/sjXBGd", - "jq9Q6h8odDWeovS2DoleOR7M1Xh6xUM4CtA0mUdENcMyiqu1AKvWgt2k7QZvKMdhwXdzQehbOUvlJBjL", - "SaDttpEoY41B0ynjOxAqfgWZtwWdY0GY+vHFb0Ap9701FzT834ufWpEZRV0hZTnoLcpWX7c4S2v7FJF2", - "YXwLsdan9klnfqrL4OHnbDq+0lfUR5AJPU7cxnKr4Lb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HDDpXpvttjggFSvebh+Qj5iLOWKi3DrbTx7ejo6qyvb", + "AhZEqmw+q/g/sHVBPmz9q9PxxArNNgcig1/PDPfnRGmvTG7y+6T0f3sLaJR0ofXEdj/zhNK1pykLTGmo", + "G9buTXWHh7of8Cz5DA9z55oK0iez4TneMt9VXmx9kEsu1EtK7iH0sDHnWYBpmqb/BQAA//+vy4pZ5ycA", + "AA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/backend/api/handler.go b/backend/api/handler.go index eca6006..a0ecd4c 100644 --- a/backend/api/handler.go +++ b/backend/api/handler.go @@ -84,9 +84,9 @@ func (h *Handler) GetGames(ctx context.Context, _ GetGamesRequestObject, user *a } games := make([]Game, len(gameRows)) for i, row := range gameRows { - var startedAt *int + var startedAt *int64 if row.StartedAt.Valid { - startedAtTimestamp := int(row.StartedAt.Time.Unix()) + startedAtTimestamp := row.StartedAt.Time.Unix() startedAt = &startedAtTimestamp } games[i] = Game{ @@ -123,9 +123,9 @@ func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, use } return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - var startedAt *int + var startedAt *int64 if row.StartedAt.Valid { - startedAtTimestamp := int(row.StartedAt.Time.Unix()) + startedAtTimestamp := row.StartedAt.Time.Unix() startedAt = &startedAtTimestamp } playerRows, err := h.q.ListGamePlayers(ctx, int32(gameID)) |
