diff --git a/src/@shared/src/database/mixin/tictactoe.ts b/src/@shared/src/database/mixin/tictactoe.ts index f09420d..656ba04 100644 --- a/src/@shared/src/database/mixin/tictactoe.ts +++ b/src/@shared/src/database/mixin/tictactoe.ts @@ -14,9 +14,9 @@ export const TicTacToeImpl: Omit = { * @param gameId The game we want to write the outcome of. * */ - setGameOutcome(this: ITicTacToeDb, id: GameId): void { + setGameOutcome(this: ITicTacToeDb, id: GameId, outcome: string): void { // Find a way to retrieve the outcome of the game. - this.prepare('INSERT INTO tictactoe (game, outcome) VALUES (@id, "draw" /* replace w/ game outcome */)').run({ id }); + this.prepare('INSERT INTO tictactoe (game, outcome) VALUES (@id, @outcome)').run({ id }); }, /** * whole function description diff --git a/src/tic-tac-toe/src/app.ts b/src/tic-tac-toe/src/app.ts index 7b1a3b2..69614eb 100644 --- a/src/tic-tac-toe/src/app.ts +++ b/src/tic-tac-toe/src/app.ts @@ -7,7 +7,7 @@ import * as auth from '@shared/auth'; import * as swagger from '@shared/swagger'; import * as utils from '@shared/utils'; import { Server } from 'socket.io'; -// import type { TicTacToeImpl } from '@shared/database/mixin/tictactoe'; +import type { TicTacToeImpl } from '@shared/database/mixin/tictactoe'; declare const __SERVICE_NAME: string; @@ -83,7 +83,7 @@ async function onReady(fastify: FastifyInstance, game: TTC) { turn: game.currentPlayer, lastResult: result, }); - // fastify.db.setGameOutcome(this, "011001"); + fastify.db.setGameOutcome("011001", result); } });