From 2fc239b3f4d49f1a257523df7c7781a2141252bf Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Mon, 5 Aug 2024 05:09:41 +0900
Subject: feat(backend): implement task queue processor

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

(limited to 'backend/query.sql')

diff --git a/backend/query.sql b/backend/query.sql
index 245d5cf..6395b9b 100644
--- a/backend/query.sql
+++ b/backend/query.sql
@@ -53,3 +53,16 @@ SET
     started_at = $6,
     problem_id = $7
 WHERE game_id = $1;
+
+-- name: CreateSubmission :one
+INSERT INTO submissions (game_id, user_id, code, code_size)
+VALUES ($1, $2, $3, $4)
+RETURNING submission_id;
+
+-- name: ListTestcasesByGameID :many
+SELECT * FROM testcases
+WHERE testcases.problem_id = (SELECT problem_id FROM games WHERE game_id = $1);
+
+-- name: CreateTestcaseExecution :exec
+INSERT INTO testcase_executions (submission_id, testcase_id, status, stdout, stderr)
+VALUES ($1, $2, $3, $4, $5);
-- 
cgit v1.3.1

