From 0908bd0a0bd11c7430739e264526797f7a097ced Mon Sep 17 00:00:00 2001 From: moonyaeyoon Date: Sun, 18 Feb 2024 19:51:11 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EC=97=AC=EC=A0=95=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/journey/journey.service.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/journey/journey.service.ts b/src/journey/journey.service.ts index 715d6f6..10533fa 100644 --- a/src/journey/journey.service.ts +++ b/src/journey/journey.service.ts @@ -118,10 +118,15 @@ export class JourneyService { if (!diary) { return; // 일지가 없으면 삭제할 필요 없음 } - const diaryImg = await DiaryImageEntity.findExistImgUrl(diary); + // 일지 삭제 + await DiaryEntity.deleteDiary(diary); - await DiaryImageEntity.deleteDiaryImg(diaryImg); + // 연결된 이미지 찾기 + const diaryImg = await DiaryImageEntity.findExistImgUrl(diary); - await DiaryEntity.deleteDiary(diary); + // 이미지 삭제 + if (diaryImg) { + await DiaryImageEntity.deleteDiaryImg(diaryImg); + } } }