Skip to content

Commit

Permalink
fix: 이미지가 전송되지 않을 시 이미지 필드를 null로 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
kmi0817 committed Jan 15, 2024
1 parent c332c08 commit 97dd920
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions BE/src/timelines/timelines.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class TimelinesService {
return this.timelinesRepository.save(timeline);
} catch (error) {
if (imagePath) {
this.storageService.delete(imagePath);
await this.storageService.delete(imagePath);
}

throw error;
Expand Down Expand Up @@ -119,6 +119,8 @@ export class TimelinesService {
);
imagePath = path;
updatedTimeline.image = imagePath;
} else {
updatedTimeline.image = null;
}

const updatedResult = await this.timelinesRepository.update(
Expand All @@ -137,7 +139,7 @@ export class TimelinesService {
return updatedResult;
} catch (error) {
if (imagePath) {
this.storageService.delete(imagePath);
await this.storageService.delete(imagePath);
}

throw error;
Expand Down

0 comments on commit 97dd920

Please sign in to comment.