game workflow corrected

This commit is contained in:
magdo
2025-11-05 20:20:22 +01:00
parent 666a2d3e87
commit 5a4be5b7d3
12 changed files with 193 additions and 298 deletions
@@ -68,8 +68,6 @@ export class StartGameCommandHandler {
orgid: command.orgid || null,
gamedecks,
players: [],
started: false,
finished: false,
winner: null,
state: GameState.WAITING,
startdate: null,
@@ -65,7 +65,6 @@ export class StartGamePlayCommandHandler {
// Update game state in database
const updatedGame = await this.gameRepository.update(game.id, {
started: true,
state: GameState.ACTIVE,
startdate: new Date()
});
@@ -111,11 +110,6 @@ export class StartGamePlayCommandHandler {
throw new Error('Game is not in waiting state and cannot be started');
}
// Check if game is already started
if (game.started) {
throw new Error('Game has already been started');
}
// Check if there are enough players (at least 2)
if (game.players.length < 2) {
throw new Error('Game needs at least 2 players to start');