Compare commits
16
Commits
e9d5d8d909
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ccd11f29a1 | ||
|
|
913c82994a | ||
|
|
24c39d23d6 | ||
|
|
a99853f417 | ||
|
|
1473c5c132 | ||
|
|
fc3f0e1677 | ||
|
|
c1a22098f7 | ||
|
|
22656ba608 | ||
|
|
924806e4c8 | ||
|
|
47ed1ba851 | ||
|
|
27b1044832 | ||
|
|
813d942638 | ||
|
|
63f8cd45af | ||
|
|
e872eeea91 | ||
|
|
735e47cdbe | ||
|
|
cdddb9a073 |
@@ -1,16 +0,0 @@
|
|||||||
import { ConceptResponseDTO } from './conceptresponse.dto';
|
|
||||||
|
|
||||||
export class ConceptInTurnResponseDTO {
|
|
||||||
constructor(partial: Partial<ConceptInTurnResponseDTO>) {
|
|
||||||
Object.assign(this, partial);
|
|
||||||
this.concept = new ConceptResponseDTO(partial.concept);
|
|
||||||
}
|
|
||||||
|
|
||||||
concept: ConceptResponseDTO;
|
|
||||||
|
|
||||||
order: number;
|
|
||||||
|
|
||||||
subconcept: number;
|
|
||||||
|
|
||||||
markers: number;
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
export class ConceptResponseDTO {
|
|
||||||
constructor(partial: Partial<ConceptResponseDTO>) {
|
|
||||||
Object.assign(this, partial);
|
|
||||||
}
|
|
||||||
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
+16
-11
@@ -1,27 +1,32 @@
|
|||||||
import { UserResponseDTO } from './userresponse.dto';
|
|
||||||
import { PlayerResponseDTO } from './playerresponse.dto';
|
import { PlayerResponseDTO } from './playerresponse.dto';
|
||||||
import { ConceptInTurnResponseDTO } from './conceptinturnresponse.dto';
|
import { MessageResponseDTO } from './messageresponse.dto';
|
||||||
|
|
||||||
export class GameResponseDTO {
|
export class GameResponseDTO {
|
||||||
constructor(partial: Partial<GameResponseDTO>) {
|
constructor(partial: Partial<GameResponseDTO>) {
|
||||||
Object.assign(this, partial);
|
this.id = partial.id;
|
||||||
this.owner = new UserResponseDTO(partial.owner);
|
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));
|
this.players = partial.players.map((p) => new PlayerResponseDTO(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partial.currentPlayer) {
|
||||||
this.currentPlayer = new PlayerResponseDTO(partial.currentPlayer);
|
this.currentPlayer = new PlayerResponseDTO(partial.currentPlayer);
|
||||||
this.currentConcepts = partial.currentConcepts.map(
|
}
|
||||||
(c) => new ConceptInTurnResponseDTO(c),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
owner: UserResponseDTO;
|
ownerId: string;
|
||||||
|
|
||||||
players: PlayerResponseDTO[];
|
players: PlayerResponseDTO[] = [];
|
||||||
|
|
||||||
currentPlayer: PlayerResponseDTO;
|
currentPlayer?: PlayerResponseDTO;
|
||||||
|
|
||||||
started: boolean;
|
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;
|
||||||
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
import { UserResponseDTO } from './userresponse.dto';
|
|
||||||
|
|
||||||
export class PlayerResponseDTO {
|
export class PlayerResponseDTO {
|
||||||
constructor(partial: Partial<PlayerResponseDTO>) {
|
constructor(partial: Partial<PlayerResponseDTO>) {
|
||||||
Object.assign(this, partial);
|
this.score = partial.score;
|
||||||
this.user = new UserResponseDTO(partial.user);
|
this.userId = partial.userId;
|
||||||
|
this.id = partial.id;
|
||||||
|
this.hasGuessed = partial.hasGuessed;
|
||||||
|
// this.user = new UserResponseDTO(partial.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
user: UserResponseDTO;
|
id: number;
|
||||||
|
userId: string;
|
||||||
score: number;
|
score: number;
|
||||||
|
hasGuessed: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
export class UserResponseDTO {
|
export class UserResponseDTO {
|
||||||
constructor(partial: Partial<UserResponseDTO>) {
|
constructor(partial: UserResponseDTO) {
|
||||||
Object.assign(this, partial);
|
this.id = partial.id;
|
||||||
|
this.username = partial.username;
|
||||||
|
this.avatar = partial.avatar;
|
||||||
}
|
}
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
|
|||||||
+39
-12
@@ -1,20 +1,47 @@
|
|||||||
import { PlayerResponseDTO } from './dto/playerresponse.dto';
|
import { MessageResponseDTO } from "./dto/messageresponse.dto";
|
||||||
|
import { PlayerResponseDTO } from "./dto/playerresponse.dto";
|
||||||
|
import type { ConceptEvent } from "./events";
|
||||||
|
|
||||||
export class GameStartEvent {
|
export class GameStartEvent implements ConceptEvent {
|
||||||
type = 'start';
|
type = "start";
|
||||||
|
constructor(public currentPlayer: PlayerResponseDTO) {
|
||||||
|
this.currentPlayer = new PlayerResponseDTO(currentPlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GameDeleteEvent {
|
export class GameDeleteEvent implements ConceptEvent {
|
||||||
type = 'delete';
|
type = "delete";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GameJoinEvent {
|
export class GameJoinEvent implements ConceptEvent {
|
||||||
type = 'joingame';
|
type = "joingame";
|
||||||
constructor(public player: PlayerResponseDTO) {}
|
constructor(public player: PlayerResponseDTO) {
|
||||||
|
this.player = new PlayerResponseDTO(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GameLeaveEvent {
|
export class GameLeaveEvent implements ConceptEvent {
|
||||||
type = 'leavegame';
|
type = "leavegame";
|
||||||
gameId?: number;
|
constructor(public player: PlayerResponseDTO) {
|
||||||
constructor(public player: PlayerResponseDTO) {}
|
this.player = new PlayerResponseDTO(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameMessageEvent implements ConceptEvent {
|
||||||
|
type = "message";
|
||||||
|
constructor(public message: MessageResponseDTO) {
|
||||||
|
this.message = new MessageResponseDTO(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameMessageDeleteEvent implements ConceptEvent {
|
||||||
|
type = "deleteMessage";
|
||||||
|
constructor(public messageId: number) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameEndTurnEvent implements ConceptEvent {
|
||||||
|
type = "endTurn";
|
||||||
|
constructor(public currentPlayer: PlayerResponseDTO) {
|
||||||
|
this.currentPlayer = new PlayerResponseDTO(currentPlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-16
@@ -1,34 +1,46 @@
|
|||||||
import { GameResponseDTO } from './dto/gameresponse.dto';
|
import { GameResponseDTO } from "./dto/gameresponse.dto";
|
||||||
import { PlayerResponseDTO } from './dto/playerresponse.dto';
|
import { PlayerResponseDTO } from "./dto/playerresponse.dto";
|
||||||
|
import type { ConceptEvent } from "./events";
|
||||||
|
|
||||||
export class LobbyCreateEvent {
|
export class LobbyCreateEvent implements ConceptEvent {
|
||||||
type = 'create';
|
type = "create";
|
||||||
constructor(public game: GameResponseDTO) {}
|
game: GameResponseDTO;
|
||||||
|
constructor(game: GameResponseDTO) {
|
||||||
|
this.game = new GameResponseDTO(game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyStartEvent {
|
export class LobbyStartEvent implements ConceptEvent {
|
||||||
type = 'start';
|
type = "start";
|
||||||
constructor(public game: GameResponseDTO) {}
|
constructor(public game: GameResponseDTO) {
|
||||||
|
this.game = new GameResponseDTO(game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyDeleteEvent {
|
export class LobbyDeleteEvent implements ConceptEvent {
|
||||||
type = 'delete';
|
type = "delete";
|
||||||
constructor(public id: number) {}
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyJoinEvent {
|
export class LobbyJoinEvent implements ConceptEvent {
|
||||||
type = 'joingame';
|
type = "joingame";
|
||||||
constructor(
|
constructor(
|
||||||
public player: PlayerResponseDTO,
|
public player: PlayerResponseDTO,
|
||||||
public game: GameResponseDTO,
|
public game: GameResponseDTO,
|
||||||
) {}
|
) {
|
||||||
|
this.player = new PlayerResponseDTO(player);
|
||||||
|
this.game = new GameResponseDTO(game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LobbyLeaveEvent {
|
export class LobbyLeaveEvent implements ConceptEvent {
|
||||||
type = 'leavegame';
|
type = "leavegame";
|
||||||
gameId?: number;
|
gameId?: number;
|
||||||
constructor(
|
constructor(
|
||||||
public player: PlayerResponseDTO,
|
public player: PlayerResponseDTO,
|
||||||
public game: GameResponseDTO,
|
public game: GameResponseDTO,
|
||||||
) {}
|
) {
|
||||||
|
this.player = new PlayerResponseDTO(player);
|
||||||
|
this.game = new GameResponseDTO(game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-13
@@ -1,26 +1,31 @@
|
|||||||
import { WordResponseDTO } from './dto/wordresponse.dto';
|
import { WordResponseDTO } from "./dto/wordresponse.dto";
|
||||||
|
import type { ConceptEvent } from "./events";
|
||||||
|
|
||||||
export class WordCreateEvent {
|
export class WordCreateEvent implements ConceptEvent {
|
||||||
type = 'create';
|
type = "create";
|
||||||
constructor(public word: WordResponseDTO) {}
|
constructor(public word: WordResponseDTO) {
|
||||||
|
this.word = new WordResponseDTO(word);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordEditEvent {
|
export class WordEditEvent implements ConceptEvent {
|
||||||
type = 'edit';
|
type = "edit";
|
||||||
constructor(public word: WordResponseDTO) {}
|
constructor(public word: WordResponseDTO) {
|
||||||
|
this.word = new WordResponseDTO(word);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordDeleteEvent {
|
export class WordDeleteEvent implements ConceptEvent {
|
||||||
type = 'delete';
|
type = "delete";
|
||||||
constructor(public id: number) {}
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordEnableEvent {
|
export class WordEnableEvent implements ConceptEvent {
|
||||||
type = 'enable';
|
type = "enable";
|
||||||
constructor(public id: number) {}
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WordDisableEvent {
|
export class WordDisableEvent implements ConceptEvent {
|
||||||
type = 'disable';
|
type = "disable";
|
||||||
constructor(public id: number) {}
|
constructor(public id: number) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user