diff --git a/src/domain/chat/chat.controller.ts b/src/domain/chat/chat.controller.ts index c064cdf..8f14f0f 100644 --- a/src/domain/chat/chat.controller.ts +++ b/src/domain/chat/chat.controller.ts @@ -6,8 +6,10 @@ import { RoomChatDto, RoomInfoDto } from 'src/domain/chat/dtos'; import { UserProfileDto } from 'src/domain/dtos/user.dto'; import { Docs } from 'src/decorators/swagger/chat.decorator'; import { User } from 'src/decorators/accessUser.decorator'; +import { ApiTags } from '@nestjs/swagger'; @Controller('chat') +@ApiTags('chat') export class ChatController { constructor(private readonly chatService: ChatService) {} diff --git a/src/domain/chat/chat.service.ts b/src/domain/chat/chat.service.ts index 9f94d8e..495eca3 100644 --- a/src/domain/chat/chat.service.ts +++ b/src/domain/chat/chat.service.ts @@ -166,7 +166,7 @@ export class ChatService { } async finishFreeChatRoom(userId: number): Promise { - await this.roomModel.findOneAndUpdate( + await this.roomModel.updateOne( { users: { $elemMatch: { userId: userId }, @@ -321,9 +321,12 @@ export class ChatService { async updateBlurStep(roomId: string, otherUser: number): Promise { const room = await this.roomModel.findOne({ id: roomId }); const index = room.users.findIndex((user) => user.userId == otherUser); - room.users[index].blur = await this.checkBlurChange(room, index); + const blurChanged = await this.checkBlurChange(room, index); - await room.save(); + if (blurChanged != null) { + room.users[index].blur = blurChanged; + await room.save(); + } return room.users[index].blur; }