From 85b7a14913c05b88b720fc546eaca5575ffe53fd Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Fri, 20 Feb 2026 21:38:58 +0900
Subject: feat(admin): add bulk rejudge for game submissions

Extract common rejudge logic into a helper method and add two new
endpoints: rejudge-latest (per-user latest only) and rejudge-all.
This allows re-running submissions in bulk after testcase changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---
 backend/query.sql | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'backend/query.sql')

diff --git a/backend/query.sql b/backend/query.sql
index 1e49780..45ac46f 100644
--- a/backend/query.sql
+++ b/backend/query.sql
@@ -265,6 +265,12 @@ FROM submissions
 WHERE game_id = $1
 ORDER BY created_at DESC;
 
+-- name: GetLatestSubmissionsByGameID :many
+SELECT DISTINCT ON (user_id) *
+FROM submissions
+WHERE game_id = $1
+ORDER BY user_id, created_at DESC;
+
 -- name: GetSubmissionByID :one
 SELECT *
 FROM submissions
-- 
cgit v1.3.1

