aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/handlers.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-01 21:38:49 +0900
committernsfisis <nsfisis@gmail.com>2024-08-01 21:38:49 +0900
commit0de9bf8ddbc2128e472b6a40d92bffbbf829fe42 (patch)
tree89378dd546b033586b11ad198c29302221802463 /backend/api/handlers.go
parent922d9348cf59df248873e27af3b27dbb0d93d9b1 (diff)
downloadiosdc-japan-2024-albatross-0de9bf8ddbc2128e472b6a40d92bffbbf829fe42.tar.gz
iosdc-japan-2024-albatross-0de9bf8ddbc2128e472b6a40d92bffbbf829fe42.tar.zst
iosdc-japan-2024-albatross-0de9bf8ddbc2128e472b6a40d92bffbbf829fe42.zip
refactor(backend): `Id` to `ID` in oapi-codegen
Diffstat (limited to 'backend/api/handlers.go')
-rw-r--r--backend/api/handlers.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/backend/api/handlers.go b/backend/api/handlers.go
index aba9366..8dfc11c 100644
--- a/backend/api/handlers.go
+++ b/backend/api/handlers.go
@@ -41,13 +41,13 @@ func (h *ApiHandler) AdminGetGames(ctx context.Context, request AdminGetGamesReq
panic("inconsistent data")
}
problem = &Problem{
- ProblemId: int(*row.ProblemID),
+ ProblemID: int(*row.ProblemID),
Title: *row.Title,
Description: *row.Description,
}
}
games[i] = Game{
- GameId: int(row.GameID),
+ GameID: int(row.GameID),
State: GameState(row.State),
DisplayName: row.DisplayName,
DurationSeconds: int(row.DurationSeconds),
@@ -61,7 +61,7 @@ func (h *ApiHandler) AdminGetGames(ctx context.Context, request AdminGetGamesReq
}
func (h *ApiHandler) AdminGetGame(ctx context.Context, request AdminGetGameRequestObject, user *auth.JWTClaims) (AdminGetGameResponseObject, error) {
- gameID := request.GameId
+ gameID := request.GameID
row, err := h.q.GetGameByID(ctx, int32(gameID))
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
@@ -85,13 +85,13 @@ func (h *ApiHandler) AdminGetGame(ctx context.Context, request AdminGetGameReque
panic("inconsistent data")
}
problem = &Problem{
- ProblemId: int(*row.ProblemID),
+ ProblemID: int(*row.ProblemID),
Title: *row.Title,
Description: *row.Description,
}
}
game := Game{
- GameId: int(row.GameID),
+ GameID: int(row.GameID),
State: GameState(row.State),
DisplayName: row.DisplayName,
DurationSeconds: int(row.DurationSeconds),
@@ -104,10 +104,10 @@ func (h *ApiHandler) AdminGetGame(ctx context.Context, request AdminGetGameReque
}
func (h *ApiHandler) AdminPutGame(ctx context.Context, request AdminPutGameRequestObject, user *auth.JWTClaims) (AdminPutGameResponseObject, error) {
- gameID := request.GameId
+ gameID := request.GameID
displayName := request.Body.DisplayName
durationSeconds := request.Body.DurationSeconds
- problemID := request.Body.ProblemId
+ problemID := request.Body.ProblemID
startedAt := request.Body.StartedAt
state := request.Body.State
@@ -196,7 +196,7 @@ func (h *ApiHandler) AdminGetUsers(ctx context.Context, request AdminGetUsersReq
responseUsers := make([]User, len(users))
for i, u := range users {
responseUsers[i] = User{
- UserId: int(u.UserID),
+ UserID: int(u.UserID),
Username: u.Username,
DisplayName: u.DisplayName,
IconPath: u.IconPath,
@@ -267,13 +267,13 @@ func (h *ApiHandler) GetGames(ctx context.Context, request GetGamesRequestObject
panic("inconsistent data")
}
problem = &Problem{
- ProblemId: int(*row.ProblemID),
+ ProblemID: int(*row.ProblemID),
Title: *row.Title,
Description: *row.Description,
}
}
games[i] = Game{
- GameId: int(row.GameID),
+ GameID: int(row.GameID),
State: GameState(row.State),
DisplayName: row.DisplayName,
DurationSeconds: int(row.DurationSeconds),
@@ -288,7 +288,7 @@ func (h *ApiHandler) GetGames(ctx context.Context, request GetGamesRequestObject
func (h *ApiHandler) GetGame(ctx context.Context, request GetGameRequestObject, user *auth.JWTClaims) (GetGameResponseObject, error) {
// TODO: check user permission
- gameID := request.GameId
+ gameID := request.GameID
row, err := h.q.GetGameByID(ctx, int32(gameID))
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
@@ -313,14 +313,14 @@ func (h *ApiHandler) GetGame(ctx context.Context, request GetGameRequestObject,
}
if user.IsAdmin || (GameState(row.State) != GameStateClosed && GameState(row.State) != GameStateWaitingEntries) {
problem = &Problem{
- ProblemId: int(*row.ProblemID),
+ ProblemID: int(*row.ProblemID),
Title: *row.Title,
Description: *row.Description,
}
}
}
game := Game{
- GameId: int(row.GameID),
+ GameID: int(row.GameID),
State: GameState(row.State),
DisplayName: row.DisplayName,
DurationSeconds: int(row.DurationSeconds),