aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-03-20 19:41:38 +0900
committernsfisis <nsfisis@gmail.com>2025-03-20 19:41:39 +0900
commit1a08d06be929900fb8d8b61a1ac0611005c277e8 (patch)
treeb064bfb79cc0021a42c423a04359504369e1faa5 /backend/api
parent96081efcce7b7e1f4540cb74cb511a341f2cb4d3 (diff)
downloadphperkaigi-2025-albatross-1a08d06be929900fb8d8b61a1ac0611005c277e8.tar.gz
phperkaigi-2025-albatross-1a08d06be929900fb8d8b61a1ac0611005c277e8.tar.zst
phperkaigi-2025-albatross-1a08d06be929900fb8d8b61a1ac0611005c277e8.zip
feat: show submission date on ranking
Diffstat (limited to 'backend/api')
-rw-r--r--backend/api/generated.go53
-rw-r--r--backend/api/handler.go15
2 files changed, 35 insertions, 33 deletions
diff --git a/backend/api/generated.go b/backend/api/generated.go
index a297c97..0616d51 100644
--- a/backend/api/generated.go
+++ b/backend/api/generated.go
@@ -79,8 +79,9 @@ type Problem struct {
// RankingEntry defines model for RankingEntry.
type RankingEntry struct {
- Player User `json:"player"`
- Score int `json:"score"`
+ Player User `json:"player"`
+ Score int `json:"score"`
+ SubmittedAt int64 `json:"submitted_at"`
}
// User defines model for User.
@@ -1127,30 +1128,30 @@ func (sh *strictHandler) PostLogin(ctx echo.Context) error {
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
- "H4sIAAAAAAAC/+xYXW/bNhf+KwTfF+iNGttNEHTZVbq1RYeiMNoVw1AUAi0d20wpUiWpOl6h/z4cUl+U",
- "5FpJm24plovAInm+Hz485GeaqCxXEqQ19OIzzZlmGVjQ7msLLAUds8JuleZ/McuVxHEu6UU1SSMqWQb0",
- "gl4GqyKq4WPBNaT0wuoCImqSLWQMxe0+RwFjNZcbWpYRzZndxhuWQczTxgAOturr2QmKubSwAU1LVK3B",
- "5EoacAE9Yelr+FiAsfiVKGlBup8szwVPnOuzK+OjbPX+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7KJOY41typRzXT+JUIyiHMDvRvmfwR+agP/EkENTzFD8DklU8jqT1HK",
+ "pjImIuRE7w959ZAFzREJSVAl02gjJKrH2+OAc+PuNHp749b+R3B3S3DtCeSe4NDBwkKxvhwLwm1PdLrz",
+ "CO7kHP2HEelRnPpxOM7+IllGjQhhK2/FjchvjMEAG04b0i8Z6zNKx4jKjO7mS04oR80N0z2a8W4Y2HH8",
+ "Snf3MQm59T3JDwHaXtyTjo/eHdGpY2SjfApGV7ZGqBG5l1t1MYjBwI2JrbvMOb4Pv7RLvtU+WBCl9kL6",
+ "9zrt28WjM3zkLugrLnh4c46uTX/FBnrLqLX4AIP73WvzN+v9PxmKUzIFrd7GbhAIXBtXb725e7B6q0Ai",
+ "B5yqqqq/AwAA///orTnDMh4AAA==",
}
// GetSwagger returns the content of the embedded swagger specification file
diff --git a/backend/api/handler.go b/backend/api/handler.go
index 4514a25..2cb04c5 100644
--- a/backend/api/handler.go
+++ b/backend/api/handler.go
@@ -252,14 +252,15 @@ func (h *Handler) GetGameWatchRanking(ctx context.Context, request GetGameWatchR
for i, row := range rows {
ranking[i] = RankingEntry{
Player: User{
- UserID: int(row.UserID),
- Username: row.Username,
- DisplayName: row.DisplayName,
- IconPath: row.IconPath,
- IsAdmin: row.IsAdmin,
- Label: toNullable(row.Label),
+ UserID: int(row.User.UserID),
+ Username: row.User.Username,
+ DisplayName: row.User.DisplayName,
+ IconPath: row.User.IconPath,
+ IsAdmin: row.User.IsAdmin,
+ Label: toNullable(row.User.Label),
},
- Score: int(row.CodeSize),
+ Score: int(row.Submission.CodeSize),
+ SubmittedAt: row.Submission.CreatedAt.Time.Unix(),
}
}
return GetGameWatchRanking200JSONResponse{