From 43f92b7774adfea276e26efcfe6b2acd76bfa07f Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Mon, 13 Jan 2025 12:08:29 +0100 Subject: [PATCH] fix: apply feedbacsk --- api/src/chat/dto/conversation.dto.ts | 2 +- api/src/chat/schemas/conversation.schema.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/chat/dto/conversation.dto.ts b/api/src/chat/dto/conversation.dto.ts index 3567c593..cd8d4670 100644 --- a/api/src/chat/dto/conversation.dto.ts +++ b/api/src/chat/dto/conversation.dto.ts @@ -46,7 +46,7 @@ export class ConversationCreateDto { @IsObjectId({ message: 'Current must be a valid objectId', }) - current?: string; + current?: string | null; @ApiProperty({ description: 'next conversation', type: Array }) @IsOptional() diff --git a/api/src/chat/schemas/conversation.schema.ts b/api/src/chat/schemas/conversation.schema.ts index efa21a60..e019ba15 100644 --- a/api/src/chat/schemas/conversation.schema.ts +++ b/api/src/chat/schemas/conversation.schema.ts @@ -80,8 +80,8 @@ export class Conversation extends ConversationStub { @Transform(({ obj }) => obj.sender.toString()) sender: string; - @Transform(({ obj }) => obj.current.toString()) - current: string; + @Transform(({ obj }) => (obj.current ? obj.current.toString() : null)) + current: string | null; @Transform(({ obj }) => obj.next.map((elem) => elem.toString())) next: string[];