Merge remote-tracking branch 'origin/main'

This commit is contained in:
2025-09-22 11:26:43 +02:00
789 changed files with 14011 additions and 16477 deletions
@@ -151,6 +151,7 @@ export class JoinGameCommandHandler {
isOnline: true
};
<<<<<<< HEAD
// Check if player name is already in use by a different player
const existingPlayerWithName = gameData.currentPlayers.find(
p => p.playerName === command.playerName && p.playerId !== command.playerId
@@ -160,6 +161,8 @@ export class JoinGameCommandHandler {
throw new Error(`Player name "${command.playerName}" is already in use in this game`);
}
=======
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
// Update players list (remove if exists, then add)
gameData.currentPlayers = gameData.currentPlayers.filter(p => p.playerId !== command.playerId);
gameData.currentPlayers.push(newPlayer);
@@ -170,6 +173,12 @@ export class JoinGameCommandHandler {
// Store updated data in Redis with TTL (24 hours)
await this.redisService.setWithExpiry(redisKey, JSON.stringify(gameData), 24 * 60 * 60);
<<<<<<< HEAD
=======
// Add player to active players set
await this.redisService.setAdd(`active_players:${game.id}`, command.playerId);
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
logOther('Game data updated in Redis', {
gameId: game.id,
gameCode: game.gamecode,
@@ -210,6 +219,10 @@ export class JoinGameCommandHandler {
gameData.currentPlayers = gameData.currentPlayers.filter(p => p.playerId !== playerId);
await this.redisService.setWithExpiry(redisKey, JSON.stringify(gameData), 24 * 60 * 60);
<<<<<<< HEAD
=======
await this.redisService.setRemove(`active_players:${gameId}`, playerId);
>>>>>>> 83fad59878db015ec8d86bdec1ecbbca0baddfd2
}
} catch (error) {
logError('Failed to remove player from Redis', error instanceof Error ? error : new Error(String(error)));