chore : working on game

This commit is contained in:
2024-12-30 00:39:14 +01:00
parent 37db0a0cdb
commit cfafcfaddf
5 changed files with 8 additions and 6 deletions
+1 -1
Submodule events updated: e9d5d8d909...cdddb9a073
+1 -1
View File
@@ -23,5 +23,5 @@ export class Player {
game: Game;
@Column({ default: 0 })
score: number;
score: number = 0;
}
+4 -2
View File
@@ -28,10 +28,13 @@ export class LobbyService {
const createdGame = this.gameRepository.create();
createdGame.owner = owner;
createdGame.seed = randomUUID();
await this.gameRepository.save(createdGame);
await this.joinGame(createdGame, owner);
const g = new GameResponseDTO(createdGame);
this.eventEmitter.emit('sse.lobby', new LobbyCreateEvent(g));
await this.joinGame(createdGame, owner);
return createdGame;
}
@@ -39,7 +42,6 @@ export class LobbyService {
const player = this.playerRepository.create();
player.user = user;
player.game = game;
this.eventEmitter.emit('sse.lobby', new LobbyJoinEvent(player, game));
this.eventEmitter.emit('sse.game.' + game.id, new GameJoinEvent(player));
await this.playerRepository.save(player);
+1 -1
View File
@@ -1,4 +1,4 @@
import { NestFactory, Reflector } from '@nestjs/core';
import { NestFactory } from '@nestjs/core';
import * as session from 'express-session';
import { AppModule } from './app.module';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
+1 -1
View File
@@ -1,7 +1,7 @@
import { User } from '../users/entities/user.entity';
declare module 'express-session' {
interface SessionData {
user: User;
user?: User;
tokenData: {
access_token: string;
token_type: string;