Skip to content

Commit

Permalink
Merge pull request #144 from HongYeseul/fix/image-api
Browse files Browse the repository at this point in the history
[fix/image-api] 일기 PATCH 로직 버그 수정
  • Loading branch information
HongYeseul authored Aug 6, 2024
2 parents 220922d + 3558550 commit ff9f2d6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
Expand Down Expand Up @@ -40,14 +38,6 @@ public ResponseEntity<?> uploadDiaryImage(
.body(imageService.uploadImage(image, FileFolder.PERSONAL_DIARY));
}

@DeleteMapping("/diary/{diaryId}")
public ResponseEntity<?> deleteDiaryImage(
@PathVariable Long diaryId
) {
imageService.deleteImage(diaryId);
return ResponseEntity.ok().build();
}

private ResponseEntity<?> sendImage(String mainBannerUrl) throws IOException {
Resource resource = new ClassPathResource(mainBannerUrl);
if (!resource.exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void mappingImageToDiary(Diary diary, Long imageId) {

public void deleteImageAndMapping(Diary diary) {
diaryToImageDAO.findByDiaryId(diary.getId()).ifPresent(diaryImage -> {
imageService.deleteImage(diaryImage.getId());
imageService.deleteImage(diaryImage.getImage().getId());
diaryToImageDAO.delete(diaryImage);
});
}
Expand Down

0 comments on commit ff9f2d6

Please sign in to comment.