From f9623a7961c3ff5ecd0045d210495e29a2f6a148 Mon Sep 17 00:00:00 2001 From: legonzaur Date: Sun, 29 Dec 2024 12:14:08 +0100 Subject: [PATCH] fix : assign event type in class --- lobby.events.ts | 12 +++++++----- word.events.ts | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lobby.events.ts b/lobby.events.ts index 3a98aa2..ecbf21a 100644 --- a/lobby.events.ts +++ b/lobby.events.ts @@ -2,20 +2,22 @@ import { GameResponseDTO } from './dto/gameresponse.dto'; import { PlayerResponseDTO } from './dto/playerresponse.dto'; export class GameCreateEvent extends GameResponseDTO { - type: 'create'; + type = 'create'; } export class GameDeleteEvent { - type: 'delete'; - constructor(public id?: number) {} + type = 'delete'; + constructor(public id?: number) { } } export class GameJoinEvent { - type: 'joingame'; + type = 'joingame'; gameId: number; constructor( public player: PlayerResponseDTO, game?: Partial, ) { - this.gameId = game.id; + if (game && game.id) { + this.gameId = game.id; + } } } diff --git a/word.events.ts b/word.events.ts index 7a901c1..7521b8d 100644 --- a/word.events.ts +++ b/word.events.ts @@ -1,26 +1,26 @@ import { WordResponseDTO } from './dto/wordresponse.dto'; export class WordCreateEvent { - type: 'create'; - constructor(public word: WordResponseDTO) {} + type = 'create'; + constructor(public word: WordResponseDTO) { } } export class WordEditEvent { - type: 'edit'; - constructor(public word: WordResponseDTO) {} + type = 'edit'; + constructor(public word: WordResponseDTO) { } } export class WordDeleteEvent { - type: 'delete'; - constructor(public id: number) {} + type = 'delete'; + constructor(public id: number) { } } export class WordEnableEvent { - type: 'enable'; - constructor(public id: number) {} + type = 'enable'; + constructor(public id: number) { } } export class WordDisableEvent { - type: 'disable'; - constructor(public id: number) {} + type = 'disable'; + constructor(public id: number) { } }