From 370c21e1b968f4790660437838e4bc12fbadf75f Mon Sep 17 00:00:00 2001 From: JoonSoo-Kim Date: Mon, 4 Dec 2023 22:08:46 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9D=BC=EA=B8=B0=20content=EC=9D=98=20?= =?UTF-8?q?=EA=B3=B5=EB=B0=B1=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - trim을 통해 일기의 content에서 앞 뒤 공백을 제거하여 오류 해결 --- BE/src/diaries/diaries.service.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/BE/src/diaries/diaries.service.ts b/BE/src/diaries/diaries.service.ts index 874b377..d973a64 100644 --- a/BE/src/diaries/diaries.service.ts +++ b/BE/src/diaries/diaries.service.ts @@ -28,11 +28,11 @@ export class DiariesService { async writeDiary(createDiaryDto: CreateDiaryDto, user: User): Promise { const { content, shapeUuid, tags } = createDiaryDto; + const trimContent = content.trim(); const shape = await this.shapesRepository.getShapeByUuid(shapeUuid); - const encryptedContent = await this.getEncryptedContent(content); + const encryptedContent = await this.getEncryptedContent(trimContent); const tagEntities = await this.getTags(tags); - const sentimentResult: SentimentDto = await this.getSentiment(content); - + const sentimentResult: SentimentDto = await this.getSentiment(trimContent); const diary = await this.diariesRepository.createDiary( createDiaryDto, encryptedContent, @@ -76,10 +76,11 @@ export class DiariesService { user: User, ): Promise { const { content, shapeUuid, tags } = updateDiaryDto; + const trimContent = content.trim(); const shape = await this.shapesRepository.getShapeByUuid(shapeUuid); - const encryptedContent = await this.getEncryptedContent(content); + const encryptedContent = await this.getEncryptedContent(trimContent); const tagEntities = await this.getTags(tags); - const sentimentResult = await this.getSentiment(content); + const sentimentResult = await this.getSentiment(trimContent); return this.diariesRepository.updateDiary( updateDiaryDto,