Skip to content

Commit

Permalink
Merge pull request #132 from MUIT-UMC/develop
Browse files Browse the repository at this point in the history
[merge] 250217 / 31th deploy
  • Loading branch information
challonsy authored Feb 16, 2025
2 parents 06c06b4 + 62c4ac2 commit 18f0cd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/muit/backend/domain/entity/member/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public void changeMusical(Musical musical){
}

public void changeImg(List<UuidFile> newImgList, List<UuidFile> oldImgList){
if(oldImgList.size()!=this.images.size()){//기존 사진 개수가 달라졌으면
if(oldImgList!=null&&oldImgList.size()!=this.images.size()){//기존 사진 개수가 달라졌으면
this.images.retainAll(oldImgList);//dto에서 보내준 이미지만 남기고 삭제된 항목은 고아객체 만들기
}
if(!newImgList.isEmpty()){
if(newImgList!=null&&!newImgList.isEmpty()){
this.images.addAll(newImgList);//새로운 이미지 추가된 건 따로 추가
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ public PostResponseDTO.GeneralPostResponseDTO editPost(Long postId, PatchPostReq
}

//기존 이미지 url->UuidFile화
List<UuidFile> dtoImgs = requestDTO.getOriginalImgUrls().stream().map(file->
uuidFileService.getUuidFileByFileUrl(file).orElseThrow(()->new GeneralException(ErrorStatus.IMAGE_NOT_FOUND))).toList();
List<UuidFile> dtoImgs = null;
if(requestDTO.getOriginalImgUrls()!=null&&!requestDTO.getOriginalImgUrls().isEmpty()){
requestDTO.getOriginalImgUrls().stream().map(file->
uuidFileService.getUuidFileByFileUrl(file).orElseThrow(()->new GeneralException(ErrorStatus.IMAGE_NOT_FOUND))).toList();
}

//수정된 이미지 s3 생성
List<UuidFile> newImgs = new ArrayList<>();
Expand Down

0 comments on commit 18f0cd5

Please sign in to comment.