(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

This commit is contained in:
apetitco 2025-12-22 19:59:49 +01:00 committed by Maix0
parent f79dc43b39
commit ed2b610f26
2 changed files with 2 additions and 2 deletions

View file

@ -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)

View file

@ -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,