This commit is contained in:
2026-10-11 13:09:34 +07:00
parent 26c65062e9
commit 74a45da402
18 changed files with 2294 additions and 82 deletions
+12 -4
View File
@@ -78,10 +78,14 @@ func (r *GamesRepo) GetGameByID(
games.started_at,
games.ended_at,
(SELECT
jsonb_build_object(
CASE WHEN EXISTS (
SELECT 1
FROM game_returns r
WHERE r.export_id = e.id
) THEN NULL ELSE jsonb_build_object(
'id', e.id, 'state', e.state, 'package_id', e.package_id,
'size', e.size, 'sha256', e.sha256, 'failure', e.failure
)
) END
FROM game_exports e
WHERE e.game_id = games.id
ORDER BY e.created_at DESC, e.id
@@ -148,10 +152,14 @@ func (r *GamesRepo) GetGames(
games.format,
games.status,
(SELECT
jsonb_build_object(
CASE WHEN EXISTS (
SELECT 1
FROM game_returns r
WHERE r.export_id = e.id
) THEN NULL ELSE jsonb_build_object(
'id', e.id, 'state', e.state, 'package_id', e.package_id,
'size', e.size, 'sha256', e.sha256, 'failure', e.failure
)
) END
FROM game_exports e
WHERE e.game_id = games.id
ORDER BY e.created_at DESC, e.id