From d1a3772f6c4513fbcc0971529fecf7afabc49aac Mon Sep 17 00:00:00 2001 From: uku Date: Fri, 22 Nov 2024 09:55:21 +0100 Subject: [PATCH] fix: make tram work again --- src/lib/index.ts | 5 +++-- src/routes/api/game/+server.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/index.ts b/src/lib/index.ts index 82d276c..a18e6dc 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -15,6 +15,7 @@ let lazyStops: GeoJSON.Feature[] | null = null; export async function createGame( userId: string, mode: string, + stopsType: string, stops: GeoJSON.Feature[], db: D1Database, ): Promise { @@ -23,9 +24,9 @@ export async function createGame( const gameSql = db .prepare( - "INSERT INTO game (id, user_id, mode, time, total_score) VALUES (?, ?, ?, unixepoch('now'), 0)", + "INSERT INTO game (id, user_id, mode, stops_type, time, total_score) VALUES (?, ?, ?, ?, unixepoch('now'), 0)", ) - .bind(uuid, userId, mode); + .bind(uuid, userId, mode, stopsType); const roundSql = db.prepare( "INSERT INTO round (game_id, points, distance, stop_name) VALUES (?, -1, -1, ?)", diff --git a/src/routes/api/game/+server.ts b/src/routes/api/game/+server.ts index 9c859b3..0ee5b31 100644 --- a/src/routes/api/game/+server.ts +++ b/src/routes/api/game/+server.ts @@ -18,7 +18,7 @@ export const GET: RequestHandler = async ({ url, platform, locals }) => { error(400, "could not select random stop"); } - const gameData = await createGame(user.id, options.mode, randomStops, db); + const gameData = await createGame(user.id, options.mode, options.stopsType, randomStops, db); return Response.json(gameData); };