diff --git a/src/main/java/me/snaptime/alarm/controller/AlarmController.java b/src/main/java/me/snaptime/alarm/controller/AlarmController.java index e96f8a61..237a5fcf 100644 --- a/src/main/java/me/snaptime/alarm/controller/AlarmController.java +++ b/src/main/java/me/snaptime/alarm/controller/AlarmController.java @@ -7,10 +7,11 @@ import jakarta.validation.constraints.NotNull; import lombok.RequiredArgsConstructor; import me.snaptime.alarm.common.AlarmType; +import me.snaptime.alarm.dto.res.FindAlarmsDto; import me.snaptime.alarm.service.AlarmService; import me.snaptime.common.CommonResponseDto; import me.snaptime.reply.dto.res.FindParentReplyResDto; -import me.snaptime.snap.dto.res.FindAlbumSnapResDto; +import me.snaptime.snap.dto.res.SnapInfoDto; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; @@ -48,7 +49,7 @@ public ResponseEntity> acceptFollowReq( @GetMapping("/snaps/{snapAlarmId}") @Operation(summary = "스냅알림 조회", description = "스냅알림을 읽음처리 후 해당스냅페이지로 이동합니다.") @Parameter(name = "snapAlarmId" , description = "snapAlarmId를 입력해주세요", required = true,example = "1") - public ResponseEntity> readSnapAlarm( + public ResponseEntity> readSnapAlarm( @AuthenticationPrincipal UserDetails userDetails, @PathVariable Long snapAlarmId) { @@ -69,6 +70,30 @@ public ResponseEntity> readReplyAlarm( alarmService.readSnapAlarm(userDetails.getUsername(), replyAlarmId))); } + @GetMapping("/count/not-read") + @Operation(summary = "미확인알림개수 조회", description = "확인되지 않은 알림개수를 조회합니다.") + public ResponseEntity> findNotReadAlarmCnt( + @AuthenticationPrincipal UserDetails userDetails) { + + return ResponseEntity.status(HttpStatus.OK) + .body(new CommonResponseDto("미확인 알림개수 조회성공", + alarmService.findNotReadAlarmCnt(userDetails.getUsername()))); + } + + @GetMapping + @Operation(summary = "알림리스트 조회", description = "자신에게 온 알림리스트를 조회합니다.
"+ + "읽지않은 알림을 먼저 보여주며 시간순으로 정렬하여 반환합니다.
"+ + "알림타입별로 반환되는 데이터가 다릅니다. 팔로우알림에는 snapUrl정보가 없으며 "+ + "댓글알림에만 댓글내용을 보여주는 previewText값이 있습니다.
"+ + "각 알림타입별로 alarmId값이 부여되기 때문에 타입이 다른 알림의 경우 id값이 중복될 수 있습니다.") + public ResponseEntity> findalarms( + @AuthenticationPrincipal UserDetails userDetails) { + + return ResponseEntity.status(HttpStatus.OK) + .body(new CommonResponseDto("알림리스트 조회성공", + alarmService.findAlarms(userDetails.getUsername()))); + } + @DeleteMapping ("/{alarmId}") @Operation(summary = "알림을 삭제합니다.", description = "읽음 여부와 상관없이 알림을 삭제합니다.
" + diff --git a/src/main/java/me/snaptime/alarm/domain/ReplyAlarm.java b/src/main/java/me/snaptime/alarm/domain/ReplyAlarm.java index 8a1dc23b..3f8bc584 100644 --- a/src/main/java/me/snaptime/alarm/domain/ReplyAlarm.java +++ b/src/main/java/me/snaptime/alarm/domain/ReplyAlarm.java @@ -40,7 +40,8 @@ public class ReplyAlarm extends BaseTimeEntity { @Enumerated(EnumType.STRING) @Column(nullable = false, name = "alarm_type") private AlarmType alarmType; - + + // 댓글이 변경되더라도 기존 댓글내용을 유지하기 위해 Reply와 연관관계를 맺지않음 @Column(nullable = false, name = "reply_message") private String replyMessage; @@ -48,10 +49,12 @@ public class ReplyAlarm extends BaseTimeEntity { private boolean isRead = false; @Builder - protected ReplyAlarm(User sender, User receiver, Snap snap, String messgae, AlarmType alarmType){ + protected ReplyAlarm(User sender, User receiver, Snap snap, String replyMessage, AlarmType alarmType){ this.sender=sender; this.receiver=receiver; this.alarmType=alarmType; + this.snap=snap; + this.replyMessage=replyMessage; } public void readAlarm(){ diff --git a/src/main/java/me/snaptime/alarm/dto/res/AlarmInfo.java b/src/main/java/me/snaptime/alarm/dto/res/AlarmInfo.java new file mode 100644 index 00000000..1f241e43 --- /dev/null +++ b/src/main/java/me/snaptime/alarm/dto/res/AlarmInfo.java @@ -0,0 +1,68 @@ +package me.snaptime.alarm.dto.res; + +import lombok.Builder; +import lombok.Getter; +import me.snaptime.alarm.common.AlarmType; +import me.snaptime.alarm.domain.FollowAlarm; +import me.snaptime.alarm.domain.ReplyAlarm; +import me.snaptime.alarm.domain.SnapAlarm; + +import java.time.LocalDateTime; + +@Builder +public record AlarmInfo( + Long alarmId, + String snapPhotoURL, + String senderName, + String senderProfilePhotoURL, + String timeAgo, + String previewText, + AlarmType alarmType, + @Getter + LocalDateTime createdDate + +) { + public static AlarmInfo toDtoByFollowAlarm(String senderProfilePhotoURL, String timeAgo, FollowAlarm followAlarm){ + + return AlarmInfo.builder() + .alarmId(followAlarm.getFollowAlarmId()) + .snapPhotoURL(null) + .senderName(followAlarm.getSender().getName()) + .senderProfilePhotoURL(senderProfilePhotoURL) + .timeAgo(timeAgo) + .previewText(null) + .alarmType(followAlarm.getAlarmType()) + .createdDate(followAlarm.getCreatedDate()) + .build(); + } + + public static AlarmInfo toDtoBySnapAlarm(String senderProfilePhotoURL, String snapPhotoURL, + String timeAgo, SnapAlarm snapAlarm){ + + return AlarmInfo.builder() + .alarmId(snapAlarm.getSnapAlarmId()) + .snapPhotoURL(snapPhotoURL) + .senderName(snapAlarm.getSender().getName()) + .senderProfilePhotoURL(senderProfilePhotoURL) + .timeAgo(timeAgo) + .previewText(null) + .alarmType(snapAlarm.getAlarmType()) + .createdDate(snapAlarm.getCreatedDate()) + .build(); + } + + public static AlarmInfo toDtoByReplyAlarm(String senderProfilePhotoURL, String snapPhotoURL, + String timeAgo, ReplyAlarm replyAlarm){ + + return AlarmInfo.builder() + .alarmId(replyAlarm.getReplyAlarmId()) + .snapPhotoURL(snapPhotoURL) + .senderName(replyAlarm.getSender().getName()) + .senderProfilePhotoURL(senderProfilePhotoURL) + .timeAgo(timeAgo) + .previewText(replyAlarm.getReplyMessage()) + .alarmType(replyAlarm.getAlarmType()) + .createdDate(replyAlarm.getCreatedDate()) + .build(); + } +} diff --git a/src/main/java/me/snaptime/alarm/dto/res/FindAlarmsDto.java b/src/main/java/me/snaptime/alarm/dto/res/FindAlarmsDto.java new file mode 100644 index 00000000..2f8ff8f6 --- /dev/null +++ b/src/main/java/me/snaptime/alarm/dto/res/FindAlarmsDto.java @@ -0,0 +1,22 @@ +package me.snaptime.alarm.dto.res; + +import lombok.Builder; + +import java.util.List; + +@Builder +public record FindAlarmsDto( + + List notReadAlarmInfos, + List readAlarmInfos + +) { + public static FindAlarmsDto toDto(List notReadAlarmInfos, List readAlarmInfos){ + + return FindAlarmsDto.builder() + .notReadAlarmInfos(notReadAlarmInfos) + .readAlarmInfos(readAlarmInfos) + .build(); + } + +} diff --git a/src/main/java/me/snaptime/alarm/repository/FollowAlarmRepository.java b/src/main/java/me/snaptime/alarm/repository/FollowAlarmRepository.java index d3f4effa..6262dcc5 100644 --- a/src/main/java/me/snaptime/alarm/repository/FollowAlarmRepository.java +++ b/src/main/java/me/snaptime/alarm/repository/FollowAlarmRepository.java @@ -1,7 +1,14 @@ package me.snaptime.alarm.repository; import me.snaptime.alarm.domain.FollowAlarm; +import me.snaptime.user.domain.User; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface FollowAlarmRepository extends JpaRepository { + + List findByReceiverAndIsRead(User user, boolean isRead); + + Long countByReceiverAndIsRead(User user, boolean isRead); } diff --git a/src/main/java/me/snaptime/alarm/repository/ReplyAlarmRepository.java b/src/main/java/me/snaptime/alarm/repository/ReplyAlarmRepository.java index e02ef161..91447bd5 100644 --- a/src/main/java/me/snaptime/alarm/repository/ReplyAlarmRepository.java +++ b/src/main/java/me/snaptime/alarm/repository/ReplyAlarmRepository.java @@ -1,7 +1,14 @@ package me.snaptime.alarm.repository; import me.snaptime.alarm.domain.ReplyAlarm; +import me.snaptime.user.domain.User; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface ReplyAlarmRepository extends JpaRepository { + + List findByReceiverAndIsRead(User user, boolean isRead); + + Long countByReceiverAndIsRead(User user, boolean isRead); } diff --git a/src/main/java/me/snaptime/alarm/repository/SnapAlarmRepository.java b/src/main/java/me/snaptime/alarm/repository/SnapAlarmRepository.java index 4516d5a9..1bc80dd1 100644 --- a/src/main/java/me/snaptime/alarm/repository/SnapAlarmRepository.java +++ b/src/main/java/me/snaptime/alarm/repository/SnapAlarmRepository.java @@ -1,8 +1,14 @@ package me.snaptime.alarm.repository; import me.snaptime.alarm.domain.SnapAlarm; +import me.snaptime.user.domain.User; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.List; + public interface SnapAlarmRepository extends JpaRepository { + List findByReceiverAndIsRead(User user, boolean isRead); + + Long countByReceiverAndIsRead(User user, boolean isRead); } diff --git a/src/main/java/me/snaptime/alarm/service/AlarmService.java b/src/main/java/me/snaptime/alarm/service/AlarmService.java index aea55702..520b5a00 100644 --- a/src/main/java/me/snaptime/alarm/service/AlarmService.java +++ b/src/main/java/me/snaptime/alarm/service/AlarmService.java @@ -2,7 +2,8 @@ import me.snaptime.alarm.common.AlarmType; import me.snaptime.reply.dto.res.FindParentReplyResDto; -import me.snaptime.snap.dto.res.SnapPagingInfo; +import me.snaptime.snap.dto.res.SnapDetailInfoDto; + public interface AlarmService { @@ -10,7 +11,7 @@ public interface AlarmService { snapAlarm을 읽음처리합니다. 읽음 처리 후 해당 스냅을 조회합니다. */ - SnapPagingInfo readSnapAlarm(String reqLoginId, Long snapAlarmId); + SnapDetailInfoDto readSnapAlarm(String reqLoginId, Long snapAlarmId); //팔로우요청을 수락 or거절한 뒤 FollowAlarm을 읽음처리합니다. String readFollowAlarm(String reqLoginId, Long followAlarmId, boolean isAccept); @@ -22,10 +23,10 @@ public interface AlarmService { FindParentReplyResDto readReplyAlarm(String reqLoginId, Long replyAlarmId); //유저의 모든 알림을 불러옵니다. - Object findAlarms(Long reqLoginId); + Object findAlarms(String reqLoginId); // 읽지않은 알림이 몇개인지 조회합니다. - Long findNotReadAlarmCnt(Long reqLoginId); + Long findNotReadAlarmCnt(String reqLoginId); /* 알림을 삭제합니다. diff --git a/src/main/java/me/snaptime/alarm/service/CreateAlarmService.java b/src/main/java/me/snaptime/alarm/service/CreateAlarmService.java index fc807f1a..ea0cbec6 100644 --- a/src/main/java/me/snaptime/alarm/service/CreateAlarmService.java +++ b/src/main/java/me/snaptime/alarm/service/CreateAlarmService.java @@ -29,5 +29,5 @@ public interface CreateAlarmService { receiver : 알림을 받는 유저 alarmType : 알림타입 */ - void createReplyAlarm(User sender, User receiver, Snap snap, String message); + void createReplyAlarm(User sender, User receiver, Snap snap, String replyMessage); } diff --git a/src/main/java/me/snaptime/alarm/service/impl/AlarmServiceImpl.java b/src/main/java/me/snaptime/alarm/service/impl/AlarmServiceImpl.java index 292dc588..64db541a 100644 --- a/src/main/java/me/snaptime/alarm/service/impl/AlarmServiceImpl.java +++ b/src/main/java/me/snaptime/alarm/service/impl/AlarmServiceImpl.java @@ -5,6 +5,8 @@ import me.snaptime.alarm.domain.FollowAlarm; import me.snaptime.alarm.domain.ReplyAlarm; import me.snaptime.alarm.domain.SnapAlarm; +import me.snaptime.alarm.dto.res.AlarmInfo; +import me.snaptime.alarm.dto.res.FindAlarmsDto; import me.snaptime.alarm.repository.FollowAlarmRepository; import me.snaptime.alarm.repository.ReplyAlarmRepository; import me.snaptime.alarm.repository.SnapAlarmRepository; @@ -15,11 +17,18 @@ import me.snaptime.friend.service.FriendService; import me.snaptime.reply.dto.res.FindParentReplyResDto; import me.snaptime.reply.service.ReplyService; -import me.snaptime.snap.dto.res.SnapPagingInfo; +import me.snaptime.snap.dto.res.SnapDetailInfoDto; import me.snaptime.snap.service.SnapService; +import me.snaptime.user.domain.User; +import me.snaptime.user.repository.UserRepository; +import me.snaptime.util.TimeAgoCalculator; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + @Service @RequiredArgsConstructor @Transactional(readOnly = true) @@ -28,6 +37,7 @@ public class AlarmServiceImpl implements AlarmService { private final SnapAlarmRepository snapAlarmRepository; private final FollowAlarmRepository followAlarmRepository; private final ReplyAlarmRepository replyAlarmRepository; + private final UserRepository userRepository; private final FriendService friendService; private final SnapService snapService; private final ReplyService replyService; @@ -36,7 +46,8 @@ public class AlarmServiceImpl implements AlarmService { @Override @Transactional - public SnapPagingInfo readSnapAlarm(String reqLoginId, Long snapAlarmId) { + public SnapDetailInfoDto readSnapAlarm(String reqLoginId, Long snapAlarmId) { + SnapAlarm snapAlarm = snapAlarmRepository.findById(snapAlarmId) .orElseThrow(() -> new CustomException(ExceptionCode.ALARM_NOT_EXIST)); @@ -81,13 +92,21 @@ public FindParentReplyResDto readReplyAlarm(String reqLoginId, Long replyAlarmId } @Override - public Object findAlarms(Long reqLoginId) { - return null; + public FindAlarmsDto findAlarms(String reqLoginId) { + User reqUser = userRepository.findByLoginId(reqLoginId) + .orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); + + return FindAlarmsDto.toDto(findSortedAlarms(reqUser,false), findSortedAlarms(reqUser,true)); } @Override - public Long findNotReadAlarmCnt(Long reqLoginId) { - return null; + public Long findNotReadAlarmCnt(String reqLoginId) { + User reqUser = userRepository.findByLoginId(reqLoginId) + .orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); + + return followAlarmRepository.countByReceiverAndIsRead(reqUser,false)+ + snapAlarmRepository.countByReceiverAndIsRead(reqUser, false)+ + replyAlarmRepository.countByReceiverAndIsRead(reqUser, false); } @Override @@ -127,4 +146,50 @@ private void isMyAlarm(String reqLoginId, String alarmReceiverLoginId){ throw new CustomException(ExceptionCode.ACCESS_FAIL_ALARM); } + + // 알림을 최신순으로 정렬하여 조회합니다. + private List findSortedAlarms(User reqUser, boolean isRead){ + + List alarmInfos = new ArrayList<>(); + + List followAlarms = followAlarmRepository.findByReceiverAndIsRead(reqUser,isRead); + List replyAlarms = replyAlarmRepository.findByReceiverAndIsRead(reqUser,isRead); + List snapAlarms = snapAlarmRepository.findByReceiverAndIsRead(reqUser,isRead); + + followAlarms.forEach(followAlarm -> { + + User sender = followAlarm.getSender(); + String profilePhotoURL = urlComponent.makeProfileURL(sender.getProfilePhoto().getProfilePhotoId()); + String timeAgo = TimeAgoCalculator.findTimeAgo(followAlarm.getCreatedDate()); + + AlarmInfo alarmInfo = AlarmInfo.toDtoByFollowAlarm(profilePhotoURL, timeAgo, followAlarm); + alarmInfos.add(alarmInfo); + }); + + replyAlarms.forEach(replyAlarm -> { + + User sender = replyAlarm.getSender(); + String profilePhotoURL = urlComponent.makeProfileURL(sender.getProfilePhoto().getProfilePhotoId()); + String snapPhotoURL = urlComponent.makePhotoURL(replyAlarm.getSnap().getFileName(),false); + String timeAgo = TimeAgoCalculator.findTimeAgo(replyAlarm.getCreatedDate()); + + AlarmInfo alarmInfo = AlarmInfo.toDtoByReplyAlarm(profilePhotoURL, snapPhotoURL, timeAgo, replyAlarm); + alarmInfos.add(alarmInfo); + }); + + snapAlarms.forEach(snapAlarm -> { + + User sender = snapAlarm.getSender(); + String profilePhotoURL = urlComponent.makeProfileURL(sender.getProfilePhoto().getProfilePhotoId()); + String snapPhotoURL = urlComponent.makePhotoURL(snapAlarm.getSnap().getFileName(),false); + String timeAgo = TimeAgoCalculator.findTimeAgo(snapAlarm.getCreatedDate()); + + AlarmInfo alarmInfo = AlarmInfo.toDtoBySnapAlarm(profilePhotoURL, snapPhotoURL, timeAgo, snapAlarm); + alarmInfos.add(alarmInfo); + }); + + alarmInfos.sort(Comparator.comparing(AlarmInfo::getCreatedDate).reversed()); + return alarmInfos; + } + } diff --git a/src/main/java/me/snaptime/alarm/service/impl/CreateAlarmServiceImpl.java b/src/main/java/me/snaptime/alarm/service/impl/CreateAlarmServiceImpl.java index e6ae571b..b71ceb48 100644 --- a/src/main/java/me/snaptime/alarm/service/impl/CreateAlarmServiceImpl.java +++ b/src/main/java/me/snaptime/alarm/service/impl/CreateAlarmServiceImpl.java @@ -49,12 +49,12 @@ public void createFollowAlarm(User sender, User receiver) { @Override @Transactional - public void createReplyAlarm(User sender, User receiver, Snap snap, String message) { + public void createReplyAlarm(User sender, User receiver, Snap snap, String replyMessage) { ReplyAlarm replyAlarm = ReplyAlarm.builder() .sender(sender) .receiver(receiver) .snap(snap) - .messgae(message) + .replyMessage(replyMessage) .alarmType(AlarmType.REPLY) .build(); diff --git a/src/main/java/me/snaptime/album/dto/res/FindAlbumResDto.java b/src/main/java/me/snaptime/album/dto/res/FindAlbumResDto.java index 45f52cf6..1c5f9920 100644 --- a/src/main/java/me/snaptime/album/dto/res/FindAlbumResDto.java +++ b/src/main/java/me/snaptime/album/dto/res/FindAlbumResDto.java @@ -1,7 +1,7 @@ package me.snaptime.album.dto.res; import lombok.Builder; -import me.snaptime.snap.dto.res.FindAlbumSnapResDto; +import me.snaptime.snap.dto.res.SnapInfoDto; import java.util.List; @@ -9,6 +9,7 @@ public record FindAlbumResDto( Long id, String name, - List snap + List snap + ) { } diff --git a/src/main/java/me/snaptime/album/service/impl/AlbumServiceImpl.java b/src/main/java/me/snaptime/album/service/impl/AlbumServiceImpl.java index 94b71dd4..8f192dbe 100644 --- a/src/main/java/me/snaptime/album/service/impl/AlbumServiceImpl.java +++ b/src/main/java/me/snaptime/album/service/impl/AlbumServiceImpl.java @@ -12,7 +12,7 @@ import me.snaptime.exception.CustomException; import me.snaptime.exception.ExceptionCode; import me.snaptime.snap.domain.Snap; -import me.snaptime.snap.dto.res.FindAlbumSnapResDto; +import me.snaptime.snap.dto.res.SnapInfoDto; import me.snaptime.snap.repository.SnapRepository; import me.snaptime.user.domain.User; import me.snaptime.user.repository.UserRepository; @@ -71,7 +71,7 @@ public FindAlbumResDto findAlbum(String uId, Long album_id) { .sorted(Comparator.comparing(Snap::getId).reversed()) .filter( snap -> !snap.isPrivate()) .map(snap -> - FindAlbumSnapResDto.entityToResDto( + SnapInfoDto.entityToResDto( snap, urlComponent.makePhotoURL(snap.getFileName(), false), urlComponent.makeProfileURL(snap.getUser().getProfilePhoto().getProfilePhotoId()) @@ -87,7 +87,7 @@ public FindAlbumResDto findAlbum(String uId, Long album_id) { .snap(foundAlbum.getSnap().stream() .sorted(Comparator.comparing(Snap::getId).reversed()) .map(snap -> - FindAlbumSnapResDto.entityToResDto( + SnapInfoDto.entityToResDto( snap, urlComponent.makePhotoURL(snap.getFileName(), snap.isPrivate()), urlComponent.makeProfileURL(snap.getUser().getProfilePhoto().getProfilePhotoId()) diff --git a/src/main/java/me/snaptime/common/BaseTimeEntity.java b/src/main/java/me/snaptime/common/BaseTimeEntity.java index 3c8fb069..06b7299f 100644 --- a/src/main/java/me/snaptime/common/BaseTimeEntity.java +++ b/src/main/java/me/snaptime/common/BaseTimeEntity.java @@ -13,6 +13,7 @@ @EntityListeners(value = {AuditingEntityListener.class}) @MappedSuperclass public abstract class BaseTimeEntity { + @CreatedDate private LocalDateTime createdDate; diff --git a/src/main/java/me/snaptime/redis/RedisConfig.java b/src/main/java/me/snaptime/config/RedisConfig.java similarity index 98% rename from src/main/java/me/snaptime/redis/RedisConfig.java rename to src/main/java/me/snaptime/config/RedisConfig.java index b8c023fb..7eb6ce94 100644 --- a/src/main/java/me/snaptime/redis/RedisConfig.java +++ b/src/main/java/me/snaptime/config/RedisConfig.java @@ -1,4 +1,4 @@ -package me.snaptime.redis; +package me.snaptime.config; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; diff --git a/src/main/java/me/snaptime/redis/RefreshToken.java b/src/main/java/me/snaptime/jwt/redis/RefreshToken.java similarity index 93% rename from src/main/java/me/snaptime/redis/RefreshToken.java rename to src/main/java/me/snaptime/jwt/redis/RefreshToken.java index 9b1ada8b..8a3c5881 100644 --- a/src/main/java/me/snaptime/redis/RefreshToken.java +++ b/src/main/java/me/snaptime/jwt/redis/RefreshToken.java @@ -1,4 +1,4 @@ -package me.snaptime.redis; +package me.snaptime.jwt.redis; import jakarta.persistence.Id; import lombok.Getter; diff --git a/src/main/java/me/snaptime/redis/RefreshTokenRepository.java b/src/main/java/me/snaptime/jwt/redis/RefreshTokenRepository.java similarity index 87% rename from src/main/java/me/snaptime/redis/RefreshTokenRepository.java rename to src/main/java/me/snaptime/jwt/redis/RefreshTokenRepository.java index c739e38e..2a3ac06e 100644 --- a/src/main/java/me/snaptime/redis/RefreshTokenRepository.java +++ b/src/main/java/me/snaptime/jwt/redis/RefreshTokenRepository.java @@ -1,4 +1,4 @@ -package me.snaptime.redis; +package me.snaptime.jwt.redis; import org.springframework.data.repository.CrudRepository; diff --git a/src/main/java/me/snaptime/profile/service/ProfileService.java b/src/main/java/me/snaptime/profile/service/ProfileService.java index cfd921e7..082c8b21 100644 --- a/src/main/java/me/snaptime/profile/service/ProfileService.java +++ b/src/main/java/me/snaptime/profile/service/ProfileService.java @@ -9,12 +9,12 @@ public interface ProfileService { /* 호출자의 loginId, 피호출자의 loginId를 통해 피호출자의 album과 snap을 조회 */ - public List getAlbumSnap(String reqLoginId, String targetLoginId); + List getAlbumSnap(String reqLoginId, String targetLoginId); /* loginId에 해당하는 User의 profile 사진을 조회 */ - public UserProfileResDto getUserProfile(String reqLoginId, String targetLoginId); + UserProfileResDto getUserProfile(String reqLoginId, String targetLoginId); /* loginId에 해당하는 User의 스냅, 팔로우, 팔로워 수 리턴 */ - public ProfileCntResDto getUserProfileCnt(String loginId); + ProfileCntResDto getUserProfileCnt(String loginId); /* loginId에 해당하는 User가 Tag된 snap들을 조회합니다 */ - public List getTagSnap(String loginId); + List getTagSnap(String loginId); } diff --git a/src/main/java/me/snaptime/profilePhoto/service/ProfilePhotoService.java b/src/main/java/me/snaptime/profilePhoto/service/ProfilePhotoService.java index a20f4113..56bfff03 100644 --- a/src/main/java/me/snaptime/profilePhoto/service/ProfilePhotoService.java +++ b/src/main/java/me/snaptime/profilePhoto/service/ProfilePhotoService.java @@ -4,8 +4,8 @@ import org.springframework.web.multipart.MultipartFile; public interface ProfilePhotoService { - public byte[] downloadPhotoFromFileSystem(Long profilePhotoId); + byte[] downloadPhotoFromFileSystem(Long profilePhotoId); - public ProfilePhotoResDto updatePhotoFromFileSystem(String loginId, MultipartFile updateFile) throws Exception; + ProfilePhotoResDto updatePhotoFromFileSystem(String loginId, MultipartFile updateFile) throws Exception; } diff --git a/src/main/java/me/snaptime/reply/dto/req/AddChildReplyReqDto.java b/src/main/java/me/snaptime/reply/dto/req/AddChildReplyReqDto.java index bfb9844f..0d40bf36 100644 --- a/src/main/java/me/snaptime/reply/dto/req/AddChildReplyReqDto.java +++ b/src/main/java/me/snaptime/reply/dto/req/AddChildReplyReqDto.java @@ -10,7 +10,7 @@ public record AddChildReplyReqDto( description = "대댓글로 등록할 내용을 입력해주세요" ) @NotBlank(message = "내용을 입력해주세요") - String content, + String replyMessage, @Schema( example = "1", diff --git a/src/main/java/me/snaptime/reply/dto/req/AddParentReplyReqDto.java b/src/main/java/me/snaptime/reply/dto/req/AddParentReplyReqDto.java index 1d00cda6..9f34f9e6 100644 --- a/src/main/java/me/snaptime/reply/dto/req/AddParentReplyReqDto.java +++ b/src/main/java/me/snaptime/reply/dto/req/AddParentReplyReqDto.java @@ -10,7 +10,7 @@ public record AddParentReplyReqDto( description = "댓글로 등록할 내용을 입력해주세요" ) @NotBlank(message = "내용을 입력해주세요") - String content, + String replyMessage, @Schema( example = "1", diff --git a/src/main/java/me/snaptime/reply/service/impl/ReplyServiceImpl.java b/src/main/java/me/snaptime/reply/service/impl/ReplyServiceImpl.java index 467035f3..511c9a7a 100644 --- a/src/main/java/me/snaptime/reply/service/impl/ReplyServiceImpl.java +++ b/src/main/java/me/snaptime/reply/service/impl/ReplyServiceImpl.java @@ -58,11 +58,11 @@ public void addParentReply(String reqLoginId, AddParentReplyReqDto addParentRepl ParentReply.builder() .user(reqUser) .snap(snap) - .content(addParentReplyReqDto.content()) + .content(addParentReplyReqDto.replyMessage()) .build() ); - createAlarmService.createReplyAlarm(reqUser, snap.getUser(), snap, addParentReplyReqDto.content()); + createAlarmService.createReplyAlarm(reqUser, snap.getUser(), snap, addParentReplyReqDto.replyMessage()); } @Transactional @@ -78,7 +78,7 @@ public void addChildReply(String reqLoginId, AddChildReplyReqDto addChildReplyRe ChildReply.builder() .parentReply(parentReply) .user(reqUser) - .content(addChildReplyReqDto.content()) + .content(addChildReplyReqDto.replyMessage()) .build() ); } @@ -92,7 +92,7 @@ public void addChildReply(String reqLoginId, AddChildReplyReqDto addChildReplyRe .parentReply(parentReply) .user(reqUser) .tagUser(tagUser) - .content(addChildReplyReqDto.content()) + .content(addChildReplyReqDto.replyMessage()) .build() ); } diff --git a/src/main/java/me/snaptime/snap/controller/SnapController.java b/src/main/java/me/snaptime/snap/controller/SnapController.java index 4a051cdd..e6a58fc1 100644 --- a/src/main/java/me/snaptime/snap/controller/SnapController.java +++ b/src/main/java/me/snaptime/snap/controller/SnapController.java @@ -9,7 +9,7 @@ import me.snaptime.common.CommonResponseDto; import me.snaptime.snap.dto.req.CreateSnapReqDto; import me.snaptime.snap.dto.req.ModifySnapReqDto; -import me.snaptime.snap.dto.res.SnapPagingInfo; +import me.snaptime.snap.dto.res.SnapDetailInfoDto; import me.snaptime.snap.service.SnapService; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -50,7 +50,7 @@ public ResponseEntity> createSnap( @Operation(summary = "Snap 찾기", description = "Snap 한 개 가져오기") @Parameter(name = "id", description = "찾을 Snap의 id") @GetMapping("/{id}") - public ResponseEntity> findSnap( + public ResponseEntity> findSnap( final @PathVariable("id") Long id, final @AuthenticationPrincipal UserDetails userDetails ) { diff --git a/src/main/java/me/snaptime/snap/controller/SnapPagingController.java b/src/main/java/me/snaptime/snap/controller/SnapPagingController.java index 8bdd2279..09dd7cdf 100644 --- a/src/main/java/me/snaptime/snap/controller/SnapPagingController.java +++ b/src/main/java/me/snaptime/snap/controller/SnapPagingController.java @@ -5,7 +5,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import me.snaptime.common.CommonResponseDto; -import me.snaptime.snap.dto.res.FindSnapPagingResDto; +import me.snaptime.snap.dto.res.SnapPagingResDto; import me.snaptime.snap.service.SnapPagingService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -25,7 +25,7 @@ public class SnapPagingController { @Operation(summary = "Snap 조회", description = "커뮤니티에서 Snap을 10개씩 페이징조회합니다.") @Parameter(name = "pageNum", description = "Snap페이지 번호를 보내주세요") @GetMapping("/community/snaps/{pageNum}") - public ResponseEntity> findSnapPage( + public ResponseEntity> findSnapPage( @AuthenticationPrincipal final UserDetails userDetails, @PathVariable final Long pageNum) { diff --git a/src/main/java/me/snaptime/snap/dto/res/FindSnapPagingResDto.java b/src/main/java/me/snaptime/snap/dto/res/FindSnapPagingResDto.java deleted file mode 100644 index 18d26b7c..00000000 --- a/src/main/java/me/snaptime/snap/dto/res/FindSnapPagingResDto.java +++ /dev/null @@ -1,20 +0,0 @@ -package me.snaptime.snap.dto.res; - -import lombok.Builder; - -import java.util.List; - -@Builder -public record FindSnapPagingResDto( - - List snapPagingInfos, - boolean hasNextPage -) { - public static FindSnapPagingResDto toDto(List snapPagingInfos, boolean hasNextPage){ - - return FindSnapPagingResDto.builder() - .snapPagingInfos(snapPagingInfos) - .hasNextPage(hasNextPage) - .build(); - } -} diff --git a/src/main/java/me/snaptime/snap/dto/res/SnapPagingInfo.java b/src/main/java/me/snaptime/snap/dto/res/SnapDetailInfoDto.java similarity index 82% rename from src/main/java/me/snaptime/snap/dto/res/SnapPagingInfo.java rename to src/main/java/me/snaptime/snap/dto/res/SnapDetailInfoDto.java index 69499f81..60f0218f 100644 --- a/src/main/java/me/snaptime/snap/dto/res/SnapPagingInfo.java +++ b/src/main/java/me/snaptime/snap/dto/res/SnapDetailInfoDto.java @@ -13,7 +13,7 @@ @Builder -public record SnapPagingInfo( +public record SnapDetailInfoDto( Long snapId, String oneLineJournal, @@ -27,10 +27,10 @@ public record SnapPagingInfo( Long likeCnt, boolean isLikedSnap ) { - public static SnapPagingInfo toDto(Tuple tuple, String profilePhotoURL, String snapPhotoURL, - List findTagUsers, Long likeCnt, boolean isLikedSnap){ + public static SnapDetailInfoDto toDto(Tuple tuple, String profilePhotoURL, String snapPhotoURL, + List findTagUsers, Long likeCnt, boolean isLikedSnap){ - return SnapPagingInfo.builder() + return SnapDetailInfoDto.builder() .snapId(tuple.get(snap.id)) .oneLineJournal(String.valueOf(tuple.get(snap.oneLineJournal))) .snapPhotoURL(snapPhotoURL) @@ -45,10 +45,10 @@ public static SnapPagingInfo toDto(Tuple tuple, String profilePhotoURL, String s .build(); } - public static SnapPagingInfo toDto(Snap snap, String profilePhotoURL, String snapPhotoURL, + public static SnapDetailInfoDto toDto(Snap snap, String profilePhotoURL, String snapPhotoURL, List findTagUsers, Long likeCnt, boolean isLikedSnap){ - return SnapPagingInfo.builder() + return SnapDetailInfoDto.builder() .snapId(snap.getId()) .oneLineJournal(snap.getOneLineJournal()) .snapPhotoURL(snapPhotoURL) diff --git a/src/main/java/me/snaptime/snap/dto/res/FindAlbumSnapResDto.java b/src/main/java/me/snaptime/snap/dto/res/SnapInfoDto.java similarity index 83% rename from src/main/java/me/snaptime/snap/dto/res/FindAlbumSnapResDto.java rename to src/main/java/me/snaptime/snap/dto/res/SnapInfoDto.java index e9015a7c..4c638764 100644 --- a/src/main/java/me/snaptime/snap/dto/res/FindAlbumSnapResDto.java +++ b/src/main/java/me/snaptime/snap/dto/res/SnapInfoDto.java @@ -6,7 +6,7 @@ import java.time.LocalDateTime; @Builder -public record FindAlbumSnapResDto( +public record SnapInfoDto( Long snapId, String oneLineJournal, String snapPhotoURL, @@ -16,14 +16,14 @@ public record FindAlbumSnapResDto( String profilePhotoURL, String userName ) { - public static FindAlbumSnapResDto entityToResDto(Snap entity, String snapPhotoURL, String profilePhotoURL) { + public static SnapInfoDto entityToResDto(Snap entity, String snapPhotoURL, String profilePhotoURL) { String userUid = null; String userName = null; if (entity.getUser() != null) { userUid = entity.getUser().getLoginId(); userName = entity.getUser().getName(); } - return FindAlbumSnapResDto.builder() + return SnapInfoDto.builder() .snapId(entity.getId()) .oneLineJournal(entity.getOneLineJournal()) .snapPhotoURL(snapPhotoURL) @@ -34,4 +34,4 @@ public static FindAlbumSnapResDto entityToResDto(Snap entity, String snapPhotoUR .userName(userName) .build(); } -} +} \ No newline at end of file diff --git a/src/main/java/me/snaptime/snap/dto/res/SnapPagingResDto.java b/src/main/java/me/snaptime/snap/dto/res/SnapPagingResDto.java new file mode 100644 index 00000000..c88e8f94 --- /dev/null +++ b/src/main/java/me/snaptime/snap/dto/res/SnapPagingResDto.java @@ -0,0 +1,20 @@ +package me.snaptime.snap.dto.res; + +import lombok.Builder; + +import java.util.List; + +@Builder +public record SnapPagingResDto( + + List snapDetailInfoDtos, + boolean hasNextPage +) { + public static SnapPagingResDto toDto(List snapDetailInfoDtos, boolean hasNextPage){ + + return SnapPagingResDto.builder() + .snapDetailInfoDtos(snapDetailInfoDtos) + .hasNextPage(hasNextPage) + .build(); + } +} diff --git a/src/main/java/me/snaptime/snap/service/SnapPagingService.java b/src/main/java/me/snaptime/snap/service/SnapPagingService.java index fa297d71..60f1c8b5 100644 --- a/src/main/java/me/snaptime/snap/service/SnapPagingService.java +++ b/src/main/java/me/snaptime/snap/service/SnapPagingService.java @@ -1,6 +1,6 @@ package me.snaptime.snap.service; -import me.snaptime.snap.dto.res.FindSnapPagingResDto; +import me.snaptime.snap.dto.res.SnapPagingResDto; public interface SnapPagingService { @@ -8,5 +8,5 @@ public interface SnapPagingService { 자신이 팔로우한 유저들의 스냅을 최신순으로 불러옵니다. 커뮤니티 기능이므로 10개씩 페이징처리를 합니다. */ - FindSnapPagingResDto findSnapPage(String reqLoginId, Long pageNum); + SnapPagingResDto findSnapPage(String reqLoginId, Long pageNum); } diff --git a/src/main/java/me/snaptime/snap/service/SnapService.java b/src/main/java/me/snaptime/snap/service/SnapService.java index e5e55088..a39de401 100644 --- a/src/main/java/me/snaptime/snap/service/SnapService.java +++ b/src/main/java/me/snaptime/snap/service/SnapService.java @@ -2,14 +2,14 @@ import me.snaptime.snap.dto.req.CreateSnapReqDto; import me.snaptime.snap.dto.req.ModifySnapReqDto; -import me.snaptime.snap.dto.res.SnapPagingInfo; +import me.snaptime.snap.dto.res.SnapDetailInfoDto; import java.util.List; public interface SnapService { Long createSnap(CreateSnapReqDto createSnapReqDto, String userUid, boolean isPrivate, List tagUserLoginIds, Long album_id); - SnapPagingInfo findSnap(Long id, String uId); + SnapDetailInfoDto findSnap(Long id, String uId); Long modifySnap(Long snapId, ModifySnapReqDto modifySnapReqDto, String userUid, List tagUserLoginIds, boolean isPrivate); void changeVisibility(Long snapId, String userUid, boolean isPrivate); void deleteSnap(Long id, String Uid); diff --git a/src/main/java/me/snaptime/snap/service/impl/SnapPagingServiceImpl.java b/src/main/java/me/snaptime/snap/service/impl/SnapPagingServiceImpl.java index 73952c44..e0ad10c7 100644 --- a/src/main/java/me/snaptime/snap/service/impl/SnapPagingServiceImpl.java +++ b/src/main/java/me/snaptime/snap/service/impl/SnapPagingServiceImpl.java @@ -5,8 +5,8 @@ import me.snaptime.component.url.UrlComponent; import me.snaptime.exception.CustomException; import me.snaptime.exception.ExceptionCode; -import me.snaptime.snap.dto.res.FindSnapPagingResDto; -import me.snaptime.snap.dto.res.SnapPagingInfo; +import me.snaptime.snap.dto.res.SnapDetailInfoDto; +import me.snaptime.snap.dto.res.SnapPagingResDto; import me.snaptime.snap.repository.SnapRepository; import me.snaptime.snap.service.SnapPagingService; import me.snaptime.snapLike.service.SnapLikeService; @@ -35,7 +35,7 @@ public class SnapPagingServiceImpl implements SnapPagingService { private final SnapTagService snapTagService; private final SnapLikeService snapLikeService; - public FindSnapPagingResDto findSnapPage(String reqLoginId, Long pageNum){ + public SnapPagingResDto findSnapPage(String reqLoginId, Long pageNum){ User reqUser = userRepository.findByLoginId(reqLoginId) .orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); @@ -43,20 +43,20 @@ public FindSnapPagingResDto findSnapPage(String reqLoginId, Long pageNum){ List tuples = snapRepository.findSnapPaging(pageNum,reqUser); boolean hasNextPage = NextPageChecker.hasNextPage(tuples,10L); - List snapPagingInfos = tuples.stream().map( tuple -> + List snapDetailInfoDtos = tuples.stream().map(tuple -> { Long snapId = tuple.get(snap.id); String profilePhotoURL = urlComponent.makeProfileURL(tuple.get(user.profilePhoto.profilePhotoId)); String snapPhotoURL = urlComponent.makePhotoURL(tuple.get(snap.fileName),false); - return SnapPagingInfo.toDto(tuple,profilePhotoURL,snapPhotoURL, + return SnapDetailInfoDto.toDto(tuple,profilePhotoURL,snapPhotoURL, snapTagService.findTagUsers(snapId), snapLikeService.findSnapLikeCnt(snapId), snapLikeService.isLikedSnap(snapId, reqLoginId)); }).collect(Collectors.toList()); - return FindSnapPagingResDto.toDto(snapPagingInfos,hasNextPage); + return SnapPagingResDto.toDto(snapDetailInfoDtos,hasNextPage); } } diff --git a/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java b/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java index d5ce78a5..d11c23e8 100644 --- a/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java +++ b/src/main/java/me/snaptime/snap/service/impl/SnapServiceImpl.java @@ -15,7 +15,7 @@ import me.snaptime.snap.dto.file.WritePhotoToFileSystemResult; import me.snaptime.snap.dto.req.CreateSnapReqDto; import me.snaptime.snap.dto.req.ModifySnapReqDto; -import me.snaptime.snap.dto.res.SnapPagingInfo; +import me.snaptime.snap.dto.res.SnapDetailInfoDto; import me.snaptime.snap.repository.SnapRepository; import me.snaptime.snap.service.SnapService; import me.snaptime.snapLike.service.SnapLikeService; @@ -85,7 +85,7 @@ public Long createSnap(CreateSnapReqDto createSnapReqDto, String userUid, boolea } @Override - public SnapPagingInfo findSnap(Long id, String uId) { + public SnapDetailInfoDto findSnap(Long id, String uId) { Snap foundSnap = snapRepository.findById(id).orElseThrow(() -> new CustomException(ExceptionCode.SNAP_NOT_EXIST)); if(foundSnap.isPrivate()) { User foundUser = userRepository.findByLoginId(uId).orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); @@ -99,7 +99,7 @@ public SnapPagingInfo findSnap(Long id, String uId) { List findTagUsers = snapTagService.findTagUsers(foundSnap.getId()); Long likeCnt = snapLikeService.findSnapLikeCnt(foundSnap.getId()); boolean isLikedSnap = snapLikeService.isLikedSnap(foundSnap.getId(), uId); - return SnapPagingInfo.toDto(foundSnap, snapPhotoUrl, profilePhotoUrl, findTagUsers, likeCnt, isLikedSnap); + return SnapDetailInfoDto.toDto(foundSnap, profilePhotoUrl, snapPhotoUrl, findTagUsers, likeCnt, isLikedSnap); } @Override diff --git a/src/main/java/me/snaptime/user/service/SignService.java b/src/main/java/me/snaptime/user/service/SignService.java index 1cb5fa1b..a9c7d4b6 100644 --- a/src/main/java/me/snaptime/user/service/SignService.java +++ b/src/main/java/me/snaptime/user/service/SignService.java @@ -9,10 +9,10 @@ public interface SignService { /* 회원 가입 하는 메서드 */ - public UserResDto signUp(UserReqDto userReqDto); + UserResDto signUp(UserReqDto userReqDto); /* 로그인 하는 메서드, accessToken을 리턴한다 */ - public SignInResDto signIn(SignInReqDto signInReqDto); + SignInResDto signIn(SignInReqDto signInReqDto); /* 헤더에 담긴 RefreshToken 을 통해 AccessToken을 재발급합니다 */ - public SignInResDto reissueAccessToken(HttpServletRequest request); + SignInResDto reissueAccessToken(HttpServletRequest request); } diff --git a/src/main/java/me/snaptime/user/service/UserService.java b/src/main/java/me/snaptime/user/service/UserService.java index 3e2da3e5..7c008621 100644 --- a/src/main/java/me/snaptime/user/service/UserService.java +++ b/src/main/java/me/snaptime/user/service/UserService.java @@ -4,8 +4,8 @@ import me.snaptime.user.dto.res.UserResDto; public interface UserService { - public UserResDto getUser(String loginId); - public UserResDto updateUser(String loginId, UserUpdateReqDto userUpdateReqDto); - public void deleteUser(String loginId); - public void updatePassword(String loginId, String password); + UserResDto getUser(String loginId); + UserResDto updateUser(String loginId, UserUpdateReqDto userUpdateReqDto); + void deleteUser(String loginId); + void updatePassword(String loginId, String password); } diff --git a/src/main/java/me/snaptime/user/service/impl/SignServiceImpl.java b/src/main/java/me/snaptime/user/service/impl/SignServiceImpl.java index 7e7f4b5b..a36b1545 100644 --- a/src/main/java/me/snaptime/user/service/impl/SignServiceImpl.java +++ b/src/main/java/me/snaptime/user/service/impl/SignServiceImpl.java @@ -6,10 +6,10 @@ import me.snaptime.exception.CustomException; import me.snaptime.exception.ExceptionCode; import me.snaptime.jwt.JwtProvider; +import me.snaptime.jwt.redis.RefreshToken; +import me.snaptime.jwt.redis.RefreshTokenRepository; import me.snaptime.profilePhoto.domain.ProfilePhoto; import me.snaptime.profilePhoto.repository.ProfilePhotoRepository; -import me.snaptime.redis.RefreshToken; -import me.snaptime.redis.RefreshTokenRepository; import me.snaptime.user.domain.User; import me.snaptime.user.dto.req.SignInReqDto; import me.snaptime.user.dto.req.UserReqDto; diff --git a/src/test/java/me/snaptime/snap/service/SnapPagingServiceImplTest.java b/src/test/java/me/snaptime/snap/service/SnapPagingServiceImplTest.java index 25887448..7e68b126 100644 --- a/src/test/java/me/snaptime/snap/service/SnapPagingServiceImplTest.java +++ b/src/test/java/me/snaptime/snap/service/SnapPagingServiceImplTest.java @@ -2,7 +2,7 @@ import com.querydsl.core.Tuple; import me.snaptime.component.url.UrlComponent; -import me.snaptime.snap.dto.res.FindSnapPagingResDto; +import me.snaptime.snap.dto.res.SnapPagingResDto; import me.snaptime.snap.repository.SnapRepository; import me.snaptime.snap.service.impl.SnapPagingServiceImpl; import me.snaptime.snapLike.service.SnapLikeService; @@ -84,21 +84,21 @@ public void findSnapPagingTest1(){ given(snapRepository.findSnapPaging(any(Long.class),any(User.class))).willReturn(List.of(tuple1,tuple2,tuple3)); // when - FindSnapPagingResDto findSnapPagingResDto = snapPagingServiceImpl.findSnapPage("testLoginId",1L); + SnapPagingResDto snapPagingResDto = snapPagingServiceImpl.findSnapPage("testLoginId",1L); // then - assertThat(findSnapPagingResDto.snapPagingInfos().size()).isEqualTo(3); - assertThat(findSnapPagingResDto.snapPagingInfos().get(0).snapId()).isEqualTo(1); - assertThat(findSnapPagingResDto.snapPagingInfos().get(1).snapId()).isEqualTo(2); - assertThat(findSnapPagingResDto.snapPagingInfos().get(2).snapId()).isEqualTo(3); + assertThat(snapPagingResDto.snapDetailInfoDtos().size()).isEqualTo(3); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(0).snapId()).isEqualTo(1); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(1).snapId()).isEqualTo(2); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(2).snapId()).isEqualTo(3); - assertThat(findSnapPagingResDto.snapPagingInfos().get(0).oneLineJournal()).isEqualTo("일기1"); - assertThat(findSnapPagingResDto.snapPagingInfos().get(1).oneLineJournal()).isEqualTo("일기2"); - assertThat(findSnapPagingResDto.snapPagingInfos().get(2).oneLineJournal()).isEqualTo("일기3"); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(0).oneLineJournal()).isEqualTo("일기1"); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(1).oneLineJournal()).isEqualTo("일기2"); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(2).oneLineJournal()).isEqualTo("일기3"); - assertThat(findSnapPagingResDto.snapPagingInfos().get(0).snapPhotoURL()).isEqualTo("photoURL1"); - assertThat(findSnapPagingResDto.snapPagingInfos().get(1).snapPhotoURL()).isEqualTo("photoURL2"); - assertThat(findSnapPagingResDto.snapPagingInfos().get(2).snapPhotoURL()).isEqualTo("photoURL3"); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(0).snapPhotoURL()).isEqualTo("photoURL1"); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(1).snapPhotoURL()).isEqualTo("photoURL2"); + assertThat(snapPagingResDto.snapDetailInfoDtos().get(2).snapPhotoURL()).isEqualTo("photoURL3"); verify(snapRepository,times(1)).findSnapPaging(any(Long.class),any(User.class)); verify(userRepository,times(1)).findByLoginId(any(String.class)); diff --git a/src/test/java/me/snaptime/social/controller/ReplyControllerTest.java b/src/test/java/me/snaptime/social/controller/ReplyControllerTest.java index 28cad735..7d8253e9 100644 --- a/src/test/java/me/snaptime/social/controller/ReplyControllerTest.java +++ b/src/test/java/me/snaptime/social/controller/ReplyControllerTest.java @@ -82,7 +82,7 @@ public void addParentReplyTest2() throws Exception { .contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isBadRequest()) .andExpect(jsonPath("$.msg").value("올바르지 않은 입력값입니다")) - .andExpect(jsonPath("$.result.content").value("내용을 입력해주세요")) + .andExpect(jsonPath("$.result.replyMessage").value("내용을 입력해주세요")) .andDo(print()); verify(replyService,times(0)) @@ -176,7 +176,7 @@ public void addChildReplyTest2() throws Exception { .andExpect(status().isBadRequest()) .andExpect(jsonPath("$.msg").value("올바르지 않은 입력값입니다")) .andExpect(jsonPath("$.result.parentReplyId").value("parentReplyId를 입력해주세요.")) - .andExpect(jsonPath("$.result.content").value("내용을 입력해주세요")) + .andExpect(jsonPath("$.result.replyMessage").value("내용을 입력해주세요")) .andDo(print()); verify(replyService,times(0)) diff --git a/src/test/java/me/snaptime/user/service/UserServiceTest.java b/src/test/java/me/snaptime/user/service/UserServiceTest.java index f9a7cef6..7d79458b 100644 --- a/src/test/java/me/snaptime/user/service/UserServiceTest.java +++ b/src/test/java/me/snaptime/user/service/UserServiceTest.java @@ -1,10 +1,10 @@ package me.snaptime.user.service; import me.snaptime.jwt.JwtProvider; +import me.snaptime.jwt.redis.RefreshToken; +import me.snaptime.jwt.redis.RefreshTokenRepository; import me.snaptime.profilePhoto.domain.ProfilePhoto; import me.snaptime.profilePhoto.repository.ProfilePhotoRepository; -import me.snaptime.redis.RefreshToken; -import me.snaptime.redis.RefreshTokenRepository; import me.snaptime.user.domain.User; import me.snaptime.user.dto.req.SignInReqDto; import me.snaptime.user.dto.req.UserReqDto;