From ed2b610f267d60b3a5ccb631ca7be55099edbf3f Mon Sep 17 00:00:00 2001 From: apetitco Date: Mon, 22 Dec 2025 19:59:49 +0100 Subject: [PATCH] (tic-tac-toe): Fixed the issue, game now correctly writes into database. Need to implement generation of random IDs for games and fetch users' UID --- src/@shared/src/database/init.sql | 2 +- src/tic-tac-toe/src/app.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/@shared/src/database/init.sql b/src/@shared/src/database/init.sql index e416c54..7d9e0df 100644 --- a/src/@shared/src/database/init.sql +++ b/src/@shared/src/database/init.sql @@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS tictactoe ( id INTEGER PRIMARY KEY NOT NULL, player1 TEXT NOT NULL, player2 TEXT NOT NULL, - outcome TEXT NOT NULL, + outcome TEXT NOT NULL -- FOREIGN KEY(player1) REFERENCES user(id) -- FOREIGN KEY(player2) REFERENCES user(id) diff --git a/src/tic-tac-toe/src/app.ts b/src/tic-tac-toe/src/app.ts index 163996a..913255a 100644 --- a/src/tic-tac-toe/src/app.ts +++ b/src/tic-tac-toe/src/app.ts @@ -78,7 +78,7 @@ async function onReady(fastify: FastifyInstance, game: TTC) { } else { if (result !== 'ongoing') { - fastify.db.setGameOutcome('011001', 'Aless', 'Clara', result); + fastify.db.setGameOutcome('011001', 'player1', 'player2', result); } fastify.io.emit('gameState', { board: game.board,