33 lines
810 B
TypeScript
33 lines
810 B
TypeScript
import { PlayerResponseDTO } from './playerresponse.dto';
|
|
import { MessageResponseDTO } from './messageresponse.dto';
|
|
|
|
export class GameResponseDTO {
|
|
constructor(partial: Partial<GameResponseDTO>) {
|
|
this.id = partial.id;
|
|
this.started = partial.started;
|
|
this.ownerId = partial.ownerId;
|
|
if (partial.messages) {
|
|
this.messages = partial.messages.map((m) => new MessageResponseDTO(m));
|
|
}
|
|
if (partial.players) {
|
|
this.players = partial.players.map((p) => new PlayerResponseDTO(p));
|
|
}
|
|
|
|
if (partial.currentPlayer) {
|
|
this.currentPlayer = new PlayerResponseDTO(partial.currentPlayer);
|
|
}
|
|
}
|
|
|
|
id: number;
|
|
|
|
ownerId: string;
|
|
|
|
players: PlayerResponseDTO[] = [];
|
|
|
|
currentPlayer?: PlayerResponseDTO;
|
|
|
|
started: boolean;
|
|
|
|
messages: MessageResponseDTO[] = [];
|
|
}
|