From 0de9bf8ddbc2128e472b6a40d92bffbbf829fe42 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 1 Aug 2024 21:38:49 +0900 Subject: refactor(backend): `Id` to `ID` in oapi-codegen --- backend/api/handlers.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'backend/api/handlers.go') 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), -- cgit v1.2.3-70-g09d2