Fix : add userID to ReadUserDto
This commit is contained in:
@@ -99,7 +99,7 @@ export class GamesController {
|
|||||||
@Param('id', GamePipe) _game: Document<Game> & Game,
|
@Param('id', GamePipe) _game: Document<Game> & Game,
|
||||||
): Observable<{ data: string }> {
|
): Observable<{ data: string }> {
|
||||||
return fromEvent(this.eventEmitter, 'sse.game.' + id).pipe(
|
return fromEvent(this.eventEmitter, 'sse.game.' + id).pipe(
|
||||||
map((payload) => {
|
map((payload: any) => {
|
||||||
return {
|
return {
|
||||||
data: JSON.stringify(payload),
|
data: JSON.stringify(payload),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ export class LobbyController {
|
|||||||
|
|
||||||
@Sse('/subscribe')
|
@Sse('/subscribe')
|
||||||
subscribe(): Observable<{ data: string }> {
|
subscribe(): Observable<{ data: string }> {
|
||||||
console.log('subscris');
|
|
||||||
return fromEvent(this.eventEmitter, 'sse.lobby').pipe(
|
return fromEvent(this.eventEmitter, 'sse.lobby').pipe(
|
||||||
map((payload) => {
|
map((payload) => {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -62,15 +62,22 @@ export class ReadContainerDto extends DatabaseObjectDto {
|
|||||||
|
|
||||||
export class ReadUserDto extends DatabaseObjectDto {
|
export class ReadUserDto extends DatabaseObjectDto {
|
||||||
constructor(
|
constructor(
|
||||||
data: { username: string; avatar: string } & ConstructorParameters<
|
data: {
|
||||||
typeof DatabaseObjectDto
|
username: string;
|
||||||
>[0],
|
avatar: string;
|
||||||
|
userId: string;
|
||||||
|
} & ConstructorParameters<typeof DatabaseObjectDto>[0],
|
||||||
) {
|
) {
|
||||||
super(data);
|
super(data);
|
||||||
|
|
||||||
this.username = data.username;
|
this.username = data.username;
|
||||||
this.avatar = data.avatar;
|
this.avatar = data.avatar;
|
||||||
|
this.userId = data.userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
userId: string;
|
||||||
|
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
username: string;
|
username: string;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
|
||||||
import mongoose, { HydratedDocument, Model, ObjectId, Types } from 'mongoose';
|
import mongoose, { HydratedDocument, Types } from 'mongoose';
|
||||||
import { Card } from 'src/cards/schemas/cards.schema';
|
import { Card } from 'src/cards/schemas/cards.schema';
|
||||||
import { CardRole } from 'src/cards/schemas/cards.types';
|
import { CardRole } from 'src/cards/schemas/cards.types';
|
||||||
import { User } from 'src/users/schemas/user.entity';
|
import { User } from 'src/users/schemas/user.entity';
|
||||||
|
|||||||
Reference in New Issue
Block a user