Skip to content

Commit

Permalink
Merge branch 'hotfix/20240801-3'
Browse files Browse the repository at this point in the history
  • Loading branch information
dragontaek-lee committed Aug 1, 2024
2 parents 70508ad + 50cae2e commit 033f563
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,17 @@ public WorkEditResponseDTO updateWork(Long userId, WorkEditRequestDTO request) {
work.setTitle(request.title());
work.setDetail(request.detail());

if (!work.getPhotoUrl().equals(request.image())) {
val image = request.image();

if (work.isFirst()) {
val user = findUser(userId);
user.setWorkThumbNail(image);
}

if (!work.getPhotoUrl().equals(image)) {
val deletePhotoUrl = work.getPhotoUrl();
s3Service.deleteS3Image(deletePhotoUrl);
work.setPhotoUrl(request.image());
work.setPhotoUrl(image);
}

return WorkEditResponseDTO.of(workId);
Expand Down

0 comments on commit 033f563

Please sign in to comment.