From daaf81ae931654e20f882fbc6bbc4a02cbfc0273 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sun, 28 Jul 2024 20:09:09 +0900
Subject: feat(backend): partially implement gaming

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

(limited to 'backend/query.sql')

diff --git a/backend/query.sql b/backend/query.sql
index 9b038a5..b2ad2c4 100644
--- a/backend/query.sql
+++ b/backend/query.sql
@@ -18,3 +18,19 @@ SELECT * FROM games
 LEFT JOIN problems ON games.problem_id = problems.problem_id
 JOIN game_players ON games.game_id = game_players.game_id
 WHERE game_players.user_id = $1;
+
+-- name: UpdateGameState :exec
+UPDATE games
+SET state = $2
+WHERE game_id = $1;
+
+-- name: UpdateGameStartedAt :exec
+UPDATE games
+SET started_at = $2
+WHERE game_id = $1;
+
+-- name: GetGameById :one
+SELECT * FROM games
+LEFT JOIN problems ON games.problem_id = problems.problem_id
+WHERE games.game_id = $1
+LIMIT 1;
-- 
cgit v1.2.3-70-g09d2

