diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-06 01:09:20 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-06 01:09:20 +0900 |
| commit | e7b35cd81f2e515371a30a59ea4173a31dbeefc5 (patch) | |
| tree | 783ef649110730a8946b0021c50688d29b6dab9b /backend/db | |
| parent | e33bfff4db95586a3140b5e71a7d3dba2c72f694 (diff) | |
| download | iosdc-japan-2025-albatross-e7b35cd81f2e515371a30a59ea4173a31dbeefc5.tar.gz iosdc-japan-2025-albatross-e7b35cd81f2e515371a30a59ea4173a31dbeefc5.tar.zst iosdc-japan-2025-albatross-e7b35cd81f2e515371a30a59ea4173a31dbeefc5.zip | |
feat(backend): add admin page for game creation
Diffstat (limited to 'backend/db')
| -rw-r--r-- | backend/db/query.sql.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go index 3f85f46..001933a 100644 --- a/backend/db/query.sql.go +++ b/backend/db/query.sql.go @@ -50,6 +50,33 @@ func (q *Queries) AggregateTestcaseResults(ctx context.Context, submissionID int return status, err } +const createGame = `-- name: CreateGame :one +INSERT INTO games (game_type, is_public, display_name, duration_seconds, problem_id) +VALUES ($1, $2, $3, $4, $5) +RETURNING game_id +` + +type CreateGameParams struct { + GameType string + IsPublic bool + DisplayName string + DurationSeconds int32 + ProblemID int32 +} + +func (q *Queries) CreateGame(ctx context.Context, arg CreateGameParams) (int32, error) { + row := q.db.QueryRow(ctx, createGame, + arg.GameType, + arg.IsPublic, + arg.DisplayName, + arg.DurationSeconds, + arg.ProblemID, + ) + var game_id int32 + err := row.Scan(&game_id) + return game_id, err +} + const createProblem = `-- name: CreateProblem :one INSERT INTO problems (title, description, language, sample_code) VALUES ($1, $2, $3, $4) |
