aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/query.sql
diff options
context:
space:
mode:
Diffstat (limited to 'backend/query.sql')
-rw-r--r--backend/query.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/backend/query.sql b/backend/query.sql
index 4a06ee7..9f272b1 100644
--- a/backend/query.sql
+++ b/backend/query.sql
@@ -194,3 +194,26 @@ SELECT submission_id FROM submissions;
-- name: ListGameStateIDs :many
SELECT game_id, user_id FROM game_states;
+
+-- name: ListProblems :many
+SELECT * FROM problems
+ORDER BY problem_id;
+
+-- name: GetProblemByID :one
+SELECT * FROM problems
+WHERE problem_id = $1
+LIMIT 1;
+
+-- name: CreateProblem :one
+INSERT INTO problems (title, description, language, sample_code)
+VALUES ($1, $2, $3, $4)
+RETURNING problem_id;
+
+-- name: UpdateProblem :exec
+UPDATE problems
+SET
+ title = $2,
+ description = $3,
+ language = $4,
+ sample_code = $5
+WHERE problem_id = $1;