Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9d5d8d909 |
@@ -1,20 +1,16 @@
|
|||||||
import { Expose, Type } from 'class-transformer';
|
|
||||||
import { ConceptResponseDTO } from './conceptresponse.dto';
|
import { ConceptResponseDTO } from './conceptresponse.dto';
|
||||||
|
|
||||||
export class ConceptInTurnResponseDTO {
|
export class ConceptInTurnResponseDTO {
|
||||||
constructor(partial: Partial<ConceptInTurnResponseDTO>) {
|
constructor(partial: Partial<ConceptInTurnResponseDTO>) {
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
|
this.concept = new ConceptResponseDTO(partial.concept);
|
||||||
}
|
}
|
||||||
@Type(() => ConceptResponseDTO)
|
|
||||||
@Expose()
|
|
||||||
concept: ConceptResponseDTO;
|
concept: ConceptResponseDTO;
|
||||||
|
|
||||||
@Expose()
|
|
||||||
order: number;
|
order: number;
|
||||||
|
|
||||||
@Expose()
|
|
||||||
subconcept: number;
|
subconcept: number;
|
||||||
|
|
||||||
@Expose()
|
|
||||||
markers: number;
|
markers: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
import { Expose } from 'class-transformer';
|
|
||||||
|
|
||||||
export class ConceptResponseDTO {
|
export class ConceptResponseDTO {
|
||||||
constructor(partial: Partial<ConceptResponseDTO>) {
|
constructor(partial: Partial<ConceptResponseDTO>) {
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Expose()
|
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
@Expose()
|
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-15
@@ -1,4 +1,3 @@
|
|||||||
import { Expose, Type } from 'class-transformer';
|
|
||||||
import { UserResponseDTO } from './userresponse.dto';
|
import { UserResponseDTO } from './userresponse.dto';
|
||||||
import { PlayerResponseDTO } from './playerresponse.dto';
|
import { PlayerResponseDTO } from './playerresponse.dto';
|
||||||
import { ConceptInTurnResponseDTO } from './conceptinturnresponse.dto';
|
import { ConceptInTurnResponseDTO } from './conceptinturnresponse.dto';
|
||||||
@@ -6,31 +5,23 @@ import { ConceptInTurnResponseDTO } from './conceptinturnresponse.dto';
|
|||||||
export class GameResponseDTO {
|
export class GameResponseDTO {
|
||||||
constructor(partial: Partial<GameResponseDTO>) {
|
constructor(partial: Partial<GameResponseDTO>) {
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
this.owner = partial.owner;
|
this.owner = new UserResponseDTO(partial.owner);
|
||||||
this.players = partial.players;
|
this.players = partial.players.map((p) => new PlayerResponseDTO(p));
|
||||||
this.currentPlayer = partial.currentPlayer;
|
this.currentPlayer = new PlayerResponseDTO(partial.currentPlayer);
|
||||||
this.currentConcepts = partial.currentConcepts;
|
this.currentConcepts = partial.currentConcepts.map(
|
||||||
|
(c) => new ConceptInTurnResponseDTO(c),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Expose()
|
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
@Type(() => UserResponseDTO)
|
|
||||||
@Expose()
|
|
||||||
owner: UserResponseDTO;
|
owner: UserResponseDTO;
|
||||||
|
|
||||||
@Type(() => PlayerResponseDTO)
|
|
||||||
@Expose()
|
|
||||||
players: PlayerResponseDTO[];
|
players: PlayerResponseDTO[];
|
||||||
|
|
||||||
@Type(() => PlayerResponseDTO)
|
|
||||||
@Expose()
|
|
||||||
currentPlayer: PlayerResponseDTO;
|
currentPlayer: PlayerResponseDTO;
|
||||||
|
|
||||||
@Expose()
|
|
||||||
started: boolean;
|
started: boolean;
|
||||||
|
|
||||||
@Type(() => ConceptInTurnResponseDTO)
|
|
||||||
@Expose()
|
|
||||||
currentConcepts: ConceptInTurnResponseDTO[];
|
currentConcepts: ConceptInTurnResponseDTO[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
import { Expose, Type } from 'class-transformer';
|
|
||||||
import { UserResponseDTO } from './userresponse.dto';
|
import { UserResponseDTO } from './userresponse.dto';
|
||||||
|
|
||||||
export class PlayerResponseDTO {
|
export class PlayerResponseDTO {
|
||||||
constructor(partial: Partial<PlayerResponseDTO>) {
|
constructor(partial: Partial<PlayerResponseDTO>) {
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
this.user = partial.user;
|
this.user = new UserResponseDTO(partial.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Type(() => UserResponseDTO)
|
|
||||||
@Expose()
|
|
||||||
user: UserResponseDTO;
|
user: UserResponseDTO;
|
||||||
|
|
||||||
@Expose()
|
|
||||||
score: number;
|
score: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
export class UserResponseDTO {
|
export class UserResponseDTO {
|
||||||
constructor(partial: Partial<UserResponseDTO>) {
|
constructor(partial: Partial<UserResponseDTO>) {
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
|
|
||||||
}
|
}
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
export class WordResponseDTO {
|
export class WordResponseDTO {
|
||||||
constructor(partial: Partial<WordResponseDTO>) {
|
constructor(partial: Partial<WordResponseDTO>) {
|
||||||
if (partial.id) this.id = partial.id
|
if (partial.id) this.id = partial.id;
|
||||||
if (partial.value) this.value = partial.value
|
if (partial.value) this.value = partial.value;
|
||||||
if (partial.ownerId) this.ownerId = partial.ownerId
|
if (partial.ownerId) this.ownerId = partial.ownerId;
|
||||||
if (partial.enabled) this.enabled = partial.enabled
|
if (partial.enabled) this.enabled = partial.enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
id: number;
|
id: number;
|
||||||
@@ -14,9 +14,5 @@ export class WordResponseDTO {
|
|||||||
|
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
|
||||||
loading?: boolean = false
|
loading?: boolean = false;
|
||||||
|
|
||||||
toJSON() {
|
|
||||||
return { ...this } // here I make a POJO's copy of the class instance
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { PlayerResponseDTO } from './dto/playerresponse.dto';
|
||||||
|
|
||||||
|
export class GameStartEvent {
|
||||||
|
type = 'start';
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameDeleteEvent {
|
||||||
|
type = 'delete';
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameJoinEvent {
|
||||||
|
type = 'joingame';
|
||||||
|
constructor(public player: PlayerResponseDTO) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameLeaveEvent {
|
||||||
|
type = 'leavegame';
|
||||||
|
gameId?: number;
|
||||||
|
constructor(public player: PlayerResponseDTO) {}
|
||||||
|
}
|
||||||
+9
-9
@@ -1,34 +1,34 @@
|
|||||||
import { GameResponseDTO } from "./dto/gameresponse.dto";
|
import { GameResponseDTO } from './dto/gameresponse.dto';
|
||||||
import { PlayerResponseDTO } from "./dto/playerresponse.dto";
|
import { PlayerResponseDTO } from './dto/playerresponse.dto';
|
||||||
|
|
||||||
export class LobbyCreateEvent {
|
export class LobbyCreateEvent {
|
||||||
type = "create";
|
type = 'create';
|
||||||
constructor(public game: GameResponseDTO) {}
|
constructor(public game: GameResponseDTO) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyStartEvent {
|
export class LobbyStartEvent {
|
||||||
type = "start";
|
type = 'start';
|
||||||
constructor(public game: GameResponseDTO) {}
|
constructor(public game: GameResponseDTO) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyDeleteEvent {
|
export class LobbyDeleteEvent {
|
||||||
type = "delete";
|
type = 'delete';
|
||||||
constructor(public id: number) {}
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyJoinEvent {
|
export class LobbyJoinEvent {
|
||||||
type = "joingame";
|
type = 'joingame';
|
||||||
constructor(
|
constructor(
|
||||||
public player: PlayerResponseDTO,
|
public player: PlayerResponseDTO,
|
||||||
public game: GameResponseDTO
|
public game: GameResponseDTO,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyLeaveEvent {
|
export class LobbyLeaveEvent {
|
||||||
type = "leavegame";
|
type = 'leavegame';
|
||||||
gameId?: number;
|
gameId?: number;
|
||||||
constructor(
|
constructor(
|
||||||
public player: PlayerResponseDTO,
|
public player: PlayerResponseDTO,
|
||||||
public game: GameResponseDTO
|
public game: GameResponseDTO,
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -2,25 +2,25 @@ import { WordResponseDTO } from './dto/wordresponse.dto';
|
|||||||
|
|
||||||
export class WordCreateEvent {
|
export class WordCreateEvent {
|
||||||
type = 'create';
|
type = 'create';
|
||||||
constructor(public word: WordResponseDTO) { }
|
constructor(public word: WordResponseDTO) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordEditEvent {
|
export class WordEditEvent {
|
||||||
type = 'edit';
|
type = 'edit';
|
||||||
constructor(public word: WordResponseDTO) { }
|
constructor(public word: WordResponseDTO) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordDeleteEvent {
|
export class WordDeleteEvent {
|
||||||
type = 'delete';
|
type = 'delete';
|
||||||
constructor(public id: number) { }
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordEnableEvent {
|
export class WordEnableEvent {
|
||||||
type = 'enable';
|
type = 'enable';
|
||||||
constructor(public id: number) { }
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordDisableEvent {
|
export class WordDisableEvent {
|
||||||
type = 'disable';
|
type = 'disable';
|
||||||
constructor(public id: number) { }
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user