From f50f78725d8a075cebf692ddb5e7e1fd1dcbcc46 Mon Sep 17 00:00:00 2001 From: TaetaetaE01 Date: Thu, 17 Oct 2024 13:10:53 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[fix]=20:=20request=20update=20dto=20naming?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/faq/controller/FAQAdminController.java | 6 +++--- .../{FAQModifyRequest.java => FAQUpdateRequest.java} | 2 +- .../example/bigbrotherbe/domain/faq/service/FAQService.java | 4 ++-- .../bigbrotherbe/domain/faq/service/FAQServiceImpl.java | 6 +++--- .../domain/notice/controller/NoticeAdminController.java | 6 +++--- .../domain/notice/dto/request/NoticeRegisterRequest.java | 1 - .../{NoticeModifyRequest.java => NoticeUpdateRequest.java} | 3 +-- .../bigbrotherbe/domain/notice/service/NoticeService.java | 4 ++-- .../domain/notice/service/NoticeServiceImpl.java | 6 +++--- 9 files changed, 18 insertions(+), 20 deletions(-) rename src/main/java/com/example/bigbrotherbe/domain/faq/dto/request/{FAQModifyRequest.java => FAQUpdateRequest.java} (86%) rename src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/{NoticeModifyRequest.java => NoticeUpdateRequest.java} (67%) diff --git a/src/main/java/com/example/bigbrotherbe/domain/faq/controller/FAQAdminController.java b/src/main/java/com/example/bigbrotherbe/domain/faq/controller/FAQAdminController.java index 87f80d1..123a61a 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/faq/controller/FAQAdminController.java +++ b/src/main/java/com/example/bigbrotherbe/domain/faq/controller/FAQAdminController.java @@ -1,6 +1,6 @@ package com.example.bigbrotherbe.domain.faq.controller; -import com.example.bigbrotherbe.domain.faq.dto.request.FAQModifyRequest; +import com.example.bigbrotherbe.domain.faq.dto.request.FAQUpdateRequest; import com.example.bigbrotherbe.domain.faq.dto.request.FAQRegisterRequest; import com.example.bigbrotherbe.domain.faq.dto.response.FAQResponse; import com.example.bigbrotherbe.domain.faq.entity.FAQ; @@ -38,9 +38,9 @@ public ResponseEntity> registerFAQ(@RequestPart(value = "faqRe @PutMapping("/{faqId}") public ResponseEntity> modifyFAQ(@PathVariable("faqId") Long faqId, - @RequestPart(value = "faqModifyRequest") FAQModifyRequest faqModifyRequest, + @RequestPart(value = "faqUpdateRequest") FAQUpdateRequest faqUpdateRequest, @RequestPart(value = "file", required = false) List multipartFiles) { - faqService.modify(faqId, faqModifyRequest, multipartFiles); + faqService.modify(faqId, faqUpdateRequest, multipartFiles); return ResponseEntity.ok(ApiResponse.success(SUCCESS)); } diff --git a/src/main/java/com/example/bigbrotherbe/domain/faq/dto/request/FAQModifyRequest.java b/src/main/java/com/example/bigbrotherbe/domain/faq/dto/request/FAQUpdateRequest.java similarity index 86% rename from src/main/java/com/example/bigbrotherbe/domain/faq/dto/request/FAQModifyRequest.java rename to src/main/java/com/example/bigbrotherbe/domain/faq/dto/request/FAQUpdateRequest.java index c7296ca..fe40b86 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/faq/dto/request/FAQModifyRequest.java +++ b/src/main/java/com/example/bigbrotherbe/domain/faq/dto/request/FAQUpdateRequest.java @@ -7,7 +7,7 @@ @AllArgsConstructor @NoArgsConstructor @Builder -public class FAQModifyRequest { +public class FAQUpdateRequest { private String title; private String content; } diff --git a/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQService.java b/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQService.java index 5b9605d..e6ba366 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQService.java +++ b/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQService.java @@ -1,6 +1,6 @@ package com.example.bigbrotherbe.domain.faq.service; -import com.example.bigbrotherbe.domain.faq.dto.request.FAQModifyRequest; +import com.example.bigbrotherbe.domain.faq.dto.request.FAQUpdateRequest; import com.example.bigbrotherbe.domain.faq.dto.request.FAQRegisterRequest; import com.example.bigbrotherbe.domain.faq.dto.response.FAQResponse; import com.example.bigbrotherbe.domain.faq.entity.FAQ; @@ -13,7 +13,7 @@ public interface FAQService { public void register(FAQRegisterRequest faqRegisterRequest, List multipartFiles); - public void modify(Long faqId, FAQModifyRequest faqModifyRequest, List multipartFiles); + public void modify(Long faqId, FAQUpdateRequest faqUpdateRequest, List multipartFiles); public void delete(Long faqId); diff --git a/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQServiceImpl.java b/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQServiceImpl.java index 154d844..3fa9e67 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQServiceImpl.java +++ b/src/main/java/com/example/bigbrotherbe/domain/faq/service/FAQServiceImpl.java @@ -1,7 +1,7 @@ package com.example.bigbrotherbe.domain.faq.service; import com.example.bigbrotherbe.domain.affiliation.service.AffiliationService; -import com.example.bigbrotherbe.domain.faq.dto.request.FAQModifyRequest; +import com.example.bigbrotherbe.domain.faq.dto.request.FAQUpdateRequest; import com.example.bigbrotherbe.domain.faq.dto.request.FAQRegisterRequest; import com.example.bigbrotherbe.domain.faq.dto.response.FAQResponse; import com.example.bigbrotherbe.domain.faq.entity.FAQ; @@ -69,7 +69,7 @@ public void register(FAQRegisterRequest faqRegisterRequest, List @Override @Transactional(rollbackFor = Exception.class) - public void modify(Long faqId, FAQModifyRequest faqModifyRequest, List multipartFiles) { + public void modify(Long faqId, FAQUpdateRequest faqUpdateRequest, List multipartFiles) { FAQ faq = faqRepository.findById(faqId) .orElseThrow(() -> new BusinessException(NO_EXIST_FAQ)); @@ -88,7 +88,7 @@ public void modify(Long faqId, FAQModifyRequest faqModifyRequest, List> registerNotice(@RequestPart(value = "no @PutMapping("/{noticeId}") public ResponseEntity> modifyNotice(@PathVariable("noticeId") Long noticeId, - @RequestPart(value = "noticeModifyRequest") NoticeModifyRequest noticeModifyRequest, + @RequestPart(value = "noticeUpdateRequest") NoticeUpdateRequest noticeUpdateRequest, @RequestPart(value = "file", required = false) List multipartFiles) { - noticeService.modify(noticeId, noticeModifyRequest, multipartFiles); + noticeService.modify(noticeId, noticeUpdateRequest, multipartFiles); return ResponseEntity.ok(ApiResponse.success(SUCCESS)); } diff --git a/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeRegisterRequest.java b/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeRegisterRequest.java index 2cba660..3f7d4b9 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeRegisterRequest.java +++ b/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeRegisterRequest.java @@ -7,7 +7,6 @@ import java.util.List; @Getter -@ToString @AllArgsConstructor @NoArgsConstructor @Builder diff --git a/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeModifyRequest.java b/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeUpdateRequest.java similarity index 67% rename from src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeModifyRequest.java rename to src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeUpdateRequest.java index e814434..c3dbb50 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeModifyRequest.java +++ b/src/main/java/com/example/bigbrotherbe/domain/notice/dto/request/NoticeUpdateRequest.java @@ -1,6 +1,5 @@ package com.example.bigbrotherbe.domain.notice.dto.request; -import com.example.bigbrotherbe.domain.notice.entity.Notice; import lombok.*; @Getter @@ -8,7 +7,7 @@ @AllArgsConstructor @NoArgsConstructor @Builder -public class NoticeModifyRequest { +public class NoticeUpdateRequest { private String title; private String content; diff --git a/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeService.java b/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeService.java index e92b827..2a0ae95 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeService.java +++ b/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeService.java @@ -1,6 +1,6 @@ package com.example.bigbrotherbe.domain.notice.service; -import com.example.bigbrotherbe.domain.notice.dto.request.NoticeModifyRequest; +import com.example.bigbrotherbe.domain.notice.dto.request.NoticeUpdateRequest; import com.example.bigbrotherbe.domain.notice.dto.request.NoticeRegisterRequest; import com.example.bigbrotherbe.domain.notice.dto.response.NoticeResponse; import com.example.bigbrotherbe.domain.notice.entity.Notice; @@ -13,7 +13,7 @@ public interface NoticeService { public void register(NoticeRegisterRequest noticeRegisterRequest, List multipartFiles); - public void modify(Long noticeId, NoticeModifyRequest noticeModifyRequest, List multipartFiles); + public void modify(Long noticeId, NoticeUpdateRequest noticeUpdateRequest, List multipartFiles); public void delete(Long noticeId); diff --git a/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeServiceImpl.java b/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeServiceImpl.java index 6ca8ee5..03a7702 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeServiceImpl.java +++ b/src/main/java/com/example/bigbrotherbe/domain/notice/service/NoticeServiceImpl.java @@ -4,7 +4,7 @@ import com.example.bigbrotherbe.domain.member.entity.Member; import com.example.bigbrotherbe.domain.notice.dto.response.NoticeResponse; import com.example.bigbrotherbe.domain.notice.entity.Notice; -import com.example.bigbrotherbe.domain.notice.dto.request.NoticeModifyRequest; +import com.example.bigbrotherbe.domain.notice.dto.request.NoticeUpdateRequest; import com.example.bigbrotherbe.domain.notice.dto.request.NoticeRegisterRequest; import com.example.bigbrotherbe.domain.notice.repository.NoticeRepository; import com.example.bigbrotherbe.global.common.exception.BusinessException; @@ -71,7 +71,7 @@ public void register(NoticeRegisterRequest noticeRegisterRequest, List multipartFiles) { + public void modify(Long noticeId, NoticeUpdateRequest noticeUpdateRequest, List multipartFiles) { Notice notice = noticeRepository.findById(noticeId) .orElseThrow(() -> new BusinessException(NO_EXIST_NOTICE)); @@ -90,7 +90,7 @@ public void modify(Long noticeId, NoticeModifyRequest noticeModifyRequest, List< files = fileService.updateFile(fileUpdateDTO); } - notice.update(noticeModifyRequest.getTitle(), noticeModifyRequest.getContent(), files); + notice.update(noticeUpdateRequest.getTitle(), noticeUpdateRequest.getContent(), files); } @Override From 36362c56e5561627b02d2545810adc449b4b884c Mon Sep 17 00:00:00 2001 From: TaetaetaE01 Date: Thu, 17 Oct 2024 14:26:53 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[fix]=20:=20file=20update,=20delete=20file?= =?UTF-8?q?=20path=20=EC=A7=80=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigbrotherbe/domain/event/service/EventServiceImpl.java | 4 ++-- .../bigbrotherbe/global/file/service/FileServiceImpl.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/bigbrotherbe/domain/event/service/EventServiceImpl.java b/src/main/java/com/example/bigbrotherbe/domain/event/service/EventServiceImpl.java index 74c74db..568dc97 100644 --- a/src/main/java/com/example/bigbrotherbe/domain/event/service/EventServiceImpl.java +++ b/src/main/java/com/example/bigbrotherbe/domain/event/service/EventServiceImpl.java @@ -83,10 +83,10 @@ public void updateEvent(Long eventId, EventUpdateRequest eventUpdateRequest, Lis throw new BusinessException(NOT_COUNCIL_MEMBER); } - fileUtil.CheckImageFiles(multipartFiles); - List files = null; if (fileService.checkExistRequestFile(multipartFiles)) { + fileUtil.CheckImageFiles(multipartFiles); + FileUpdateDTO fileUpdateDTO = FileUpdateDTO.builder() .fileType(EntityType.EVENT_TYPE.getType()) .multipartFileList(multipartFiles) diff --git a/src/main/java/com/example/bigbrotherbe/global/file/service/FileServiceImpl.java b/src/main/java/com/example/bigbrotherbe/global/file/service/FileServiceImpl.java index fa9438f..254cb9c 100644 --- a/src/main/java/com/example/bigbrotherbe/global/file/service/FileServiceImpl.java +++ b/src/main/java/com/example/bigbrotherbe/global/file/service/FileServiceImpl.java @@ -59,7 +59,7 @@ public List updateFile(FileUpdateDTO fileUpdateDTO) { String fileType = fileUpdateDTO.getFileType(); files.forEach(file -> { - String fileName = file.getUrl().split("/")[3]; + String fileName = file.getUrl().split("/")[4]; s3Util.deleteFile(fileType + "/" + fileName); }); @@ -82,7 +82,7 @@ public void deleteFile(FileDeleteDTO deleteDTO) { String fileType = deleteDTO.getFileType(); files.forEach(file -> { - String fileName = file.getUrl().split("/")[3]; + String fileName = file.getUrl().split("/")[4]; s3Util.deleteFile(fileType + "/" + fileName); }); }