Template
working on words
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { Expose, Type } from 'class-transformer';
|
||||
import { ConceptResponseDTO } from './conceptresponse.dto';
|
||||
|
||||
export class ConceptInTurnResponseDTO {
|
||||
constructor(partial: Partial<ConceptInTurnResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
}
|
||||
@Type(() => ConceptResponseDTO)
|
||||
@Expose()
|
||||
concept: ConceptResponseDTO;
|
||||
|
||||
@Expose()
|
||||
order: number;
|
||||
|
||||
@Expose()
|
||||
subconcept: number;
|
||||
|
||||
@Expose()
|
||||
markers: number;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Expose } from 'class-transformer';
|
||||
|
||||
export class ConceptResponseDTO {
|
||||
constructor(partial: Partial<ConceptResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
}
|
||||
|
||||
@Expose()
|
||||
id: number;
|
||||
|
||||
@Expose()
|
||||
value: string;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Expose, Type } from 'class-transformer';
|
||||
import { UserResponseDTO } from './userresponse.dto';
|
||||
import { PlayerResponseDTO } from './playerresponse.dto';
|
||||
import { ConceptInTurnResponseDTO } from './conceptinturnresponse.dto';
|
||||
|
||||
export class GameResponseDTO {
|
||||
constructor(partial: Partial<GameResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
this.owner = partial.owner;
|
||||
this.players = partial.players;
|
||||
this.currentPlayer = partial.currentPlayer;
|
||||
this.currentConcepts = partial.currentConcepts;
|
||||
}
|
||||
|
||||
@Expose()
|
||||
id: number;
|
||||
|
||||
@Type(() => UserResponseDTO)
|
||||
@Expose()
|
||||
owner: UserResponseDTO;
|
||||
|
||||
@Type(() => PlayerResponseDTO)
|
||||
@Expose()
|
||||
players: PlayerResponseDTO[];
|
||||
|
||||
@Type(() => PlayerResponseDTO)
|
||||
@Expose()
|
||||
currentPlayer: PlayerResponseDTO;
|
||||
|
||||
@Expose()
|
||||
started: boolean;
|
||||
|
||||
@Type(() => ConceptInTurnResponseDTO)
|
||||
@Expose()
|
||||
currentConcepts: ConceptInTurnResponseDTO[];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Expose, Type } from 'class-transformer';
|
||||
import { UserResponseDTO } from './userresponse.dto';
|
||||
|
||||
export class PlayerResponseDTO {
|
||||
constructor(partial: Partial<PlayerResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
this.user = partial.user;
|
||||
}
|
||||
|
||||
@Type(() => UserResponseDTO)
|
||||
@Expose()
|
||||
user: UserResponseDTO;
|
||||
|
||||
@Expose()
|
||||
score: number;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Expose } from 'class-transformer';
|
||||
|
||||
export class UserResponseDTO {
|
||||
constructor(partial: Partial<UserResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
this.id = partial.id;
|
||||
}
|
||||
@Expose()
|
||||
id: string;
|
||||
|
||||
@Expose()
|
||||
username: string;
|
||||
|
||||
@Expose()
|
||||
avatar: string;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Expose } from 'class-transformer';
|
||||
|
||||
export class WordResponseDTO {
|
||||
constructor(partial: Partial<WordResponseDTO>) {
|
||||
Object.assign(this, partial);
|
||||
}
|
||||
@Expose()
|
||||
id: number;
|
||||
|
||||
@Expose()
|
||||
value: string;
|
||||
|
||||
@Expose()
|
||||
ownerId: string;
|
||||
|
||||
@Expose()
|
||||
enabled: boolean;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { GameResponseDTO } from './dto/gameresponse.dto';
|
||||
import { PlayerResponseDTO } from './dto/playerresponse.dto';
|
||||
|
||||
export class GameCreateEvent extends GameResponseDTO {
|
||||
type: 'create';
|
||||
}
|
||||
|
||||
export class GameDeleteEvent {
|
||||
type: 'delete';
|
||||
constructor(public id?: number) {}
|
||||
}
|
||||
export class GameJoinEvent {
|
||||
type: 'joingame';
|
||||
gameId: number;
|
||||
constructor(
|
||||
public player: PlayerResponseDTO,
|
||||
game?: Partial<GameResponseDTO>,
|
||||
) {
|
||||
this.gameId = game.id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { WordResponseDTO } from './dto/wordresponse.dto';
|
||||
|
||||
export class WordCreateEvent {
|
||||
type: 'create';
|
||||
constructor(public word: WordResponseDTO) {}
|
||||
}
|
||||
|
||||
export class WordEditEvent {
|
||||
type: 'edit';
|
||||
constructor(public word: WordResponseDTO) {}
|
||||
}
|
||||
|
||||
export class WordDeleteEvent {
|
||||
type: 'delete';
|
||||
constructor(public id: number) {}
|
||||
}
|
||||
|
||||
export class WordEnableEvent {
|
||||
type: 'enable';
|
||||
constructor(public id: number) {}
|
||||
}
|
||||
|
||||
export class WordDisableEvent {
|
||||
type: 'disable';
|
||||
constructor(public id: number) {}
|
||||
}
|
||||
Reference in New Issue
Block a user