generated from legonzaur/webapp-dto
Initial commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { ConceptResponseDTO } from './conceptresponse.dto';
|
||||
|
||||
export class ConceptInTurnResponseDTO {
|
||||
constructor(partial: Partial<ConceptInTurnResponseDTO>) {
|
||||
this.order = partial.order;
|
||||
this.subconcept = partial.subconcept;
|
||||
this.markers = partial.markers;
|
||||
this.concept = new ConceptResponseDTO(partial.concept);
|
||||
}
|
||||
|
||||
concept: ConceptResponseDTO;
|
||||
|
||||
order: number;
|
||||
|
||||
subconcept: number;
|
||||
|
||||
markers: number;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { ApiRequestTimeoutResponse } from '@nestjs/swagger';
|
||||
|
||||
export class ConceptResponseDTO {
|
||||
constructor(partial: Partial<ConceptResponseDTO>) {
|
||||
this.id = partial.id;
|
||||
this.value = partial.value;
|
||||
this.type = new ConceptTypeResponseDTO(partial.type);
|
||||
}
|
||||
|
||||
id: number;
|
||||
value: string;
|
||||
type: ConceptTypeResponseDTO;
|
||||
}
|
||||
|
||||
export class ConceptTypeResponseDTO {
|
||||
constructor(partial: Partial<ConceptTypeResponseDTO>) {
|
||||
this.id = partial.id;
|
||||
this.value = partial.value;
|
||||
}
|
||||
id: number;
|
||||
value: string;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { UserResponseDTO } from './userresponse.dto';
|
||||
import { PlayerResponseDTO } from './playerresponse.dto';
|
||||
import { ConceptInTurnResponseDTO } from './conceptinturnresponse.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.currentConcepts) {
|
||||
this.currentConcepts = partial.currentConcepts.map(
|
||||
(c) => new ConceptInTurnResponseDTO(c),
|
||||
);
|
||||
}
|
||||
|
||||
if (partial.currentPlayer) {
|
||||
this.currentPlayer = new PlayerResponseDTO(partial.currentPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
id: number;
|
||||
|
||||
ownerId: string;
|
||||
|
||||
players: PlayerResponseDTO[] = [];
|
||||
|
||||
currentPlayer?: PlayerResponseDTO;
|
||||
|
||||
started: boolean;
|
||||
|
||||
currentConcepts: ConceptInTurnResponseDTO[] = [];
|
||||
|
||||
messages: MessageResponseDTO[] = [];
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export class MessageResponseDTO {
|
||||
constructor(partial: Partial<MessageResponseDTO>) {
|
||||
this.id = partial.id;
|
||||
this.value = partial.value;
|
||||
if (partial.authorId) this.authorId = partial.authorId;
|
||||
}
|
||||
|
||||
id: number;
|
||||
value: string;
|
||||
authorId?: string;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
export class PlayerResponseDTO {
|
||||
constructor(partial: Partial<PlayerResponseDTO>) {
|
||||
this.score = partial.score;
|
||||
this.userId = partial.userId;
|
||||
this.id = partial.id;
|
||||
this.hasGuessed = partial.hasGuessed;
|
||||
// this.user = new UserResponseDTO(partial.user);
|
||||
}
|
||||
|
||||
id: number;
|
||||
userId: string;
|
||||
score: number;
|
||||
hasGuessed: boolean;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
export class UserResponseDTO {
|
||||
constructor(partial: Partial<UserResponseDTO>) {
|
||||
this.id = partial.id;
|
||||
this.username = partial.username;
|
||||
this.avatar = partial.avatar;
|
||||
}
|
||||
id: string;
|
||||
|
||||
username: string;
|
||||
|
||||
avatar: string;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export class WordResponseDTO {
|
||||
constructor(partial: Partial<WordResponseDTO>) {
|
||||
if (partial.id) this.id = partial.id;
|
||||
if (partial.value) this.value = partial.value;
|
||||
if (partial.ownerId) this.ownerId = partial.ownerId;
|
||||
if (partial.enabled) this.enabled = partial.enabled;
|
||||
}
|
||||
|
||||
id: number;
|
||||
|
||||
value: string;
|
||||
|
||||
ownerId: string;
|
||||
|
||||
enabled: boolean;
|
||||
|
||||
loading?: boolean = false;
|
||||
}
|
||||
Reference in New Issue
Block a user