From 8d739b386f2b555292fd8082c9de2199228737c9 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sat, 6 Sep 2025 01:30:31 +0900
Subject: feat(backend): add admin pages for testcases

---
 backend/query.sql | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

(limited to 'backend/query.sql')

diff --git a/backend/query.sql b/backend/query.sql
index 4d95e3f..76af82b 100644
--- a/backend/query.sql
+++ b/backend/query.sql
@@ -222,3 +222,34 @@ SET
     language = $4,
     sample_code = $5
 WHERE problem_id = $1;
+
+-- name: ListTestcases :many
+SELECT * FROM testcases
+ORDER BY testcase_id;
+
+-- name: ListTestcasesByProblemID :many
+SELECT * FROM testcases
+WHERE problem_id = $1
+ORDER BY testcase_id;
+
+-- name: GetTestcaseByID :one
+SELECT * FROM testcases
+WHERE testcase_id = $1
+LIMIT 1;
+
+-- name: CreateTestcase :one
+INSERT INTO testcases (problem_id, stdin, stdout)
+VALUES ($1, $2, $3)
+RETURNING testcase_id;
+
+-- name: UpdateTestcase :exec
+UPDATE testcases
+SET
+    problem_id = $2,
+    stdin = $3,
+    stdout = $4
+WHERE testcase_id = $1;
+
+-- name: DeleteTestcase :exec
+DELETE FROM testcases
+WHERE testcase_id = $1;
-- 
cgit v1.2.3-70-g09d2

