(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:
parent
f79dc43b39
commit
ed2b610f26
2 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue