From 63ddc9af853199de080267911472ba072d6f3fc2 Mon Sep 17 00:00:00 2001 From: hellozo0 Date: Wed, 24 Apr 2024 10:21:09 +0900 Subject: [PATCH] =?UTF-8?q?#280=20[feat]=20null=EB=A1=9C=20=EC=98=AC=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=EB=8A=94=20=EC=88=98=EC=A0=95=20=EC=95=88?= =?UTF-8?q?=ED=96=88=EB=8B=A4=EB=8A=94=20=EC=9D=98=EB=AF=B8=EC=9D=B4?= =?UTF-8?q?=EA=B8=B0=20=EB=95=8C=EB=AC=B8=EC=97=90=20=EA=B8=B0=EC=A1=B4?= =?UTF-8?q?=EC=9D=98=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=EC=95=88=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/designer/DesignerRegisterService.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java index 5f403d66..6b0150a4 100644 --- a/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java +++ b/src/main/java/com/moddy/server/service/designer/DesignerRegisterService.java @@ -59,10 +59,14 @@ public UserCreateResponse createDesigner(final Long designerId, final DesignerCr @Transactional public void updateDesigner(final Long designerId, final MultipartFile profileImg, final DesignerUpdateRequest designerUpdateRequest) { Designer designer = designerJpaRepository.findById(designerId).orElseThrow(() -> new NotFoundException(DESIGNER_NOT_FOUND_EXCEPTION)); - s3Service.deleteS3Image(designer.getProfileImgUrl()); - String updatedProfileImgUrl = s3Service.uploadProfileImage(profileImg, Role.HAIR_DESIGNER); - updateUserInfos(designerId, new UserUpdateDto(designerUpdateRequest.name(), designerUpdateRequest.gender(), designer.getPhoneNumber(), designer.getIsMarketingAgree()), updatedProfileImgUrl); + String profileImgUrl = designer.getProfileImgUrl(); + if (profileImg != null) { + s3Service.deleteS3Image(profileImgUrl); + profileImgUrl = s3Service.uploadProfileImage(profileImg, Role.HAIR_DESIGNER); + } + + updateUserInfos(designerId, new UserUpdateDto(designerUpdateRequest.name(), designerUpdateRequest.gender(), designer.getPhoneNumber(), designer.getIsMarketingAgree()), profileImgUrl); designer.update(new HairShop(designerUpdateRequest.hairShop().name(), designerUpdateRequest.hairShop().address(), designerUpdateRequest.hairShop().detailAddress()), new Portfolio(designerUpdateRequest.portfolio().instagramUrl(), designer.getPortfolio().getNaverPlaceUrl()), designerUpdateRequest.introduction(), designerUpdateRequest.kakaoOpenChatUrl()); designerJpaRepository.save(designer); deleteDesignerDayoffs(designerId);