generated from legonzaur/webapp-dto
34 lines
855 B
TypeScript
34 lines
855 B
TypeScript
import { UserResponseDTO } from "./userresponse.dto";
|
|
import { PlayerResponseDTO } from "./playerresponse.dto";
|
|
import { MessageResponseDTO } from "./messageresponse.dto";
|
|
|
|
export class GameResponseDTO {
|
|
constructor(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[] = [];
|
|
}
|