Skip to content

Commit

Permalink
Merge pull request #281 from TEAM-MODDY/feat/#280
Browse files Browse the repository at this point in the history
#280 [feat] 디자이너 이미지 수정 로직 이슈 해결
  • Loading branch information
hellozo0 authored Apr 24, 2024
2 parents 519cc99 + 63ddc9a commit 6f4c675
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6f4c675

Please sign in to comment.