From 9f8a609ece9093d3aaa62937c8035903bbd8a045 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 2 Apr 2025 01:13:37 +0900 Subject: feat(backend): add admin tool to fix submission status --- backend/db/query.sql.go | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'backend/db/query.sql.go') diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go index fece99f..d4e134f 100644 --- a/backend/db/query.sql.go +++ b/backend/db/query.sql.go @@ -496,6 +496,35 @@ func (q *Queries) ListAllGames(ctx context.Context) ([]Game, error) { return items, nil } +const listGameStateIDs = `-- name: ListGameStateIDs :many +SELECT game_id, user_id FROM game_states +` + +type ListGameStateIDsRow struct { + GameID int32 + UserID int32 +} + +func (q *Queries) ListGameStateIDs(ctx context.Context) ([]ListGameStateIDsRow, error) { + rows, err := q.db.Query(ctx, listGameStateIDs) + if err != nil { + return nil, err + } + defer rows.Close() + var items []ListGameStateIDsRow + for rows.Next() { + var i ListGameStateIDsRow + if err := rows.Scan(&i.GameID, &i.UserID); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listMainPlayers = `-- name: ListMainPlayers :many SELECT game_id, game_main_players.user_id, users.user_id, username, display_name, icon_path, is_admin, label, created_at FROM game_main_players JOIN users ON game_main_players.user_id = users.user_id @@ -600,6 +629,30 @@ func (q *Queries) ListPublicGames(ctx context.Context) ([]ListPublicGamesRow, er return items, nil } +const listSubmissionIDs = `-- name: ListSubmissionIDs :many +SELECT submission_id FROM submissions +` + +func (q *Queries) ListSubmissionIDs(ctx context.Context) ([]int32, error) { + rows, err := q.db.Query(ctx, listSubmissionIDs) + if err != nil { + return nil, err + } + defer rows.Close() + var items []int32 + for rows.Next() { + var submission_id int32 + if err := rows.Scan(&submission_id); err != nil { + return nil, err + } + items = append(items, submission_id) + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const listTestcasesByGameID = `-- name: ListTestcasesByGameID :many SELECT testcase_id, problem_id, stdin, stdout FROM testcases WHERE testcases.problem_id = (SELECT problem_id FROM games WHERE game_id = $1) -- cgit v1.2.3-70-g09d2