-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] 미확인 알림개수조회 기능구현 & 나에게 온 알림리스트 조회기능 구현#119
- Loading branch information
Showing
21 changed files
with
229 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/me/snaptime/alarm/dto/res/FindAlarmsDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package me.snaptime.alarm.dto.res; | ||
|
||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
public record FindAlarmsDto( | ||
|
||
List<AlarmInfo> notReadAlarmInfos, | ||
List<AlarmInfo> readAlarmInfos | ||
|
||
) { | ||
public static FindAlarmsDto toDto(List<AlarmInfo> notReadAlarmInfos, List<AlarmInfo> readAlarmInfos){ | ||
|
||
return FindAlarmsDto.builder() | ||
.notReadAlarmInfos(notReadAlarmInfos) | ||
.readAlarmInfos(readAlarmInfos) | ||
.build(); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/me/snaptime/alarm/repository/FollowAlarmRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<FollowAlarm,Long> { | ||
|
||
List<FollowAlarm> findByReceiverAndIsRead(User user, boolean isRead); | ||
|
||
Long countByReceiverAndIsRead(User user, boolean isRead); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/me/snaptime/alarm/repository/ReplyAlarmRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<ReplyAlarm,Long> { | ||
|
||
List<ReplyAlarm> findByReceiverAndIsRead(User user, boolean isRead); | ||
|
||
Long countByReceiverAndIsRead(User user, boolean isRead); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/me/snaptime/alarm/repository/SnapAlarmRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<SnapAlarm,Long> { | ||
|
||
List<SnapAlarm> findByReceiverAndIsRead(User user, boolean isRead); | ||
|
||
Long countByReceiverAndIsRead(User user, boolean isRead); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...n/java/me/snaptime/redis/RedisConfig.java → .../java/me/snaptime/config/RedisConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../java/me/snaptime/redis/RefreshToken.java → ...a/me/snaptime/jwt/redis/RefreshToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package me.snaptime.redis; | ||
package me.snaptime.jwt.redis; | ||
|
||
import jakarta.persistence.Id; | ||
import lombok.Getter; | ||
|
2 changes: 1 addition & 1 deletion
2
...naptime/redis/RefreshTokenRepository.java → ...ime/jwt/redis/RefreshTokenRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.