From ed107ad432407a68335874fe3c10d5ead1196ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=80=E1=85=AA=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=AE=E1=86=AB?= Date: Mon, 4 Dec 2023 22:06:30 +0900 Subject: [PATCH] =?UTF-8?q?[BE]=20Fix=20:=20updateDto=20,=20=EC=B1=84?= =?UTF-8?q?=ED=8C=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BE/src/chat/chat.service.ts | 13 +++++++++---- BE/src/post/dto/postUpdate.dto.ts | 8 ++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/BE/src/chat/chat.service.ts b/BE/src/chat/chat.service.ts index 0b792b1..db8b994 100644 --- a/BE/src/chat/chat.service.ts +++ b/BE/src/chat/chat.service.ts @@ -7,6 +7,10 @@ import { ChatDto } from './dto/chat.dto'; import { UserEntity } from 'src/entities/user.entity'; import { FcmHandler, PushMessage } from '../utils/fcmHandler'; +export interface ChatRoom { + room_id: number; +} + @Injectable() export class ChatService { constructor( @@ -31,18 +35,19 @@ export class ChatService { postId: number, userId: string, writerId: string, - ): Promise { - const isExist = this.chatRoomRepository.findOne({ + ): Promise { + const isExist = await this.chatRoomRepository.findOne({ where: { post_id: postId, user: userId, writer: writerId }, }); if (isExist) { - return isExist; + return { room_id: isExist.id }; } const chatRoom = new ChatRoomEntity(); chatRoom.post_id = postId; chatRoom.writer = writerId; chatRoom.user = userId; - return await this.chatRoomRepository.save(chatRoom); + const roomId = (await this.chatRoomRepository.save(chatRoom)).id; + return { room_id: roomId }; } async findRoomList(userId: string) { diff --git a/BE/src/post/dto/postUpdate.dto.ts b/BE/src/post/dto/postUpdate.dto.ts index 9eabb31..2f7c2ae 100644 --- a/BE/src/post/dto/postUpdate.dto.ts +++ b/BE/src/post/dto/postUpdate.dto.ts @@ -13,6 +13,14 @@ export class UpdatePostDto { @IsNumber() // 전화번호 형식 검증 price?: number; + @IsOptional() + @IsString() + start_date?: string; + + @IsOptional() + @IsString() + end_date?: string; + @IsOptional() @IsString({ each: true }) deleted_images: string[];