Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package NextLevel.demo.social.dto;

import NextLevel.demo.social.entity.SocialEntity;
import NextLevel.demo.social.entity.SocialImgEntity;
import NextLevel.demo.user.entity.UserEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand All @@ -17,7 +16,7 @@ public class RequestSocialCreateDto {

private Long id;
private String text;
private List<MultipartFile> imgs;
private List<MultipartFile> img;

private Long userId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void create(RequestSocialCreateDto dto, ArrayList<Path> imgPaths) {
UserEntity user = userValidateService.getUserInfoWithAccessToken(dto.getUserId());
SocialEntity social = socialRepository.save(dto.toEntity(user));

saveImgs(dto.getImgs(), social, imgPaths);
saveImgs(dto.getImg(), social, imgPaths);
}

@ImgTransaction
Expand All @@ -63,9 +63,9 @@ public void update(RequestSocialCreateDto dto, ArrayList<Path> imgPaths) {
if(!social.getUser().getId().equals(dto.getUserId()))
throw new CustomException(ErrorCode.NOT_AUTHOR);

if(dto.getImgs() != null && !dto.getImgs().isEmpty() && !dto.getImgs().get(0).isEmpty()){
if(dto.getImg() != null && !dto.getImg().isEmpty() && !dto.getImg().get(0).isEmpty()){
deleteImgs(social.getId(), social.getImgs().stream().map(SocialImgEntity::getImg).toList());
saveImgs(dto.getImgs(), social, imgPaths);
saveImgs(dto.getImg(), social, imgPaths);
}

social.update(dto);
Expand Down
Loading