mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
fixed the map, made it so the map is scrollable and synced the timing between the admin page and map page. They now share the same elapsed time. need to fix map css for altering the svg.
Grey = cant click Red = current Green = complete blue = skipped? Need to add Clue page Need to fix Leaderboard.
This commit is contained in:
1 parent
e7ad53643c
commit
16319f1333
14 files changed
+791
-472
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { getToken } from "next-auth/jwt";
|
||||
import { queryOne } from "@/lib/db";
|
||||
import { queryOne, run } from "@/lib/db";
|
||||
|
||||
export async function GET(request, context) {
|
||||
try {
|
||||
@@ -14,7 +14,8 @@ export async function GET(request, context) {
|
||||
return Response.json({ error: "Unauthorized" }, { status: 401 });
|
||||
}
|
||||
|
||||
const { teamId } = context.params;
|
||||
// Properly await context.params
|
||||
const { teamId } = await context.params;
|
||||
|
||||
// Validate that user belongs to this team
|
||||
if (!token.teamId || parseInt(token.teamId, 10) !== parseInt(teamId, 10)) {
|
||||
@@ -24,6 +25,17 @@ export async function GET(request, context) {
|
||||
);
|
||||
}
|
||||
|
||||
// First ensure the team_hunt_sessions table exists
|
||||
await run(`
|
||||
CREATE TABLE IF NOT EXISTS team_hunt_sessions (
|
||||
team_id INTEGER PRIMARY KEY,
|
||||
start_time TEXT NOT NULL,
|
||||
initiated_by INTEGER,
|
||||
FOREIGN KEY (team_id) REFERENCES teams(id),
|
||||
FOREIGN KEY (initiated_by) REFERENCES users(id)
|
||||
)
|
||||
`);
|
||||
|
||||
// Get the team's hunt session from the database
|
||||
const session = await queryOne(
|
||||
"SELECT team_id, start_time FROM team_hunt_sessions WHERE team_id = ?",
|
||||
|
||||
Reference in new issue
Block a user