Skip to content

Commit

Permalink
merge: Feature/#641 행사 수정 삭제 api에 이미지 처리 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
amaran-th authored Sep 25, 2023
2 parents 4634d17 + d741a9f commit 3863cfd
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ public EventDetailResponse updateEvent(final Long eventId, final EventDetailRequ

final List<Tag> tags = findAllPersistTagsOrElseThrow(request.getTags());

// TODO: 2023/09/25 더 좋은 방법을 고민해보기
eventTagRepository.deleteAllByEventId(eventId);

final Event updatedEvent = event.updateEventContent(
request.getName(),
request.getLocation(),
Expand All @@ -216,9 +216,9 @@ public EventDetailResponse updateEvent(final Long eventId, final EventDetailRequ
request.getInformationUrl(),
tags
);

final List<String> imageUrls = imageRepository
.findAllByTypeAndContentId(ImageType.EVENT, event.getId())
imageCommandService.deleteImages(ImageType.EVENT, eventId);
final List<String> imageUrls = imageCommandService
.saveImages(ImageType.EVENT, event.getId(), images)
.stream()
.sorted(comparing(Image::getOrder))
.map(Image::getName)
Expand All @@ -231,7 +231,7 @@ public void deleteEvent(final Long eventId) {
if (!eventRepository.existsById(eventId)) {
throw new EventException(NOT_FOUND_EVENT);
}

imageCommandService.deleteImages(ImageType.EVENT, eventId);
eventRepository.deleteById(eventId);
}

Expand Down

0 comments on commit 3863cfd

Please sign in to comment.