-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from FOREGG-DEV/dev
✨[feat] 챌린지 찌르기 기능 생성
- Loading branch information
Showing
13 changed files
with
212 additions
and
27 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
24 changes: 15 additions & 9 deletions
24
src/main/java/foregg/foreggserver/domain/Notification.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,31 +1,37 @@ | ||
package foregg.foreggserver.domain; | ||
|
||
import foregg.foreggserver.domain.common.BaseEntity; | ||
import foregg.foreggserver.domain.enums.NotifType; | ||
import foregg.foreggserver.domain.enums.NotificationType; | ||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
@Getter | ||
public class Notification extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private NotifType notificationType; | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "sender_id") | ||
private User sender; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "receiver_id") | ||
private User receiver; | ||
|
||
@Column(nullable = false) | ||
private String content; | ||
private String date; // String -> LocalDateTime으로 변경 | ||
|
||
@Enumerated(EnumType.STRING) | ||
private NotificationType notificationType; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
} | ||
|
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
7 changes: 0 additions & 7 deletions
7
src/main/java/foregg/foreggserver/domain/enums/NotifType.java
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
src/main/java/foregg/foreggserver/domain/enums/NotificationType.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,5 @@ | ||
package foregg.foreggserver.domain.enums; | ||
|
||
public enum NotificationType { | ||
CLAP, SUPPORT, REPLY | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/main/java/foregg/foreggserver/repository/NotificationRepository.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,17 @@ | ||
package foregg.foreggserver.repository; | ||
|
||
import foregg.foreggserver.domain.Notification; | ||
import foregg.foreggserver.domain.User; | ||
import foregg.foreggserver.domain.enums.NotificationType; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.List; | ||
|
||
public interface NotificationRepository extends JpaRepository<Notification, Long> { | ||
|
||
List<Notification> findBySenderAndReceiverAndDate(User sender, User receiver, String date); | ||
|
||
Notification findBySenderAndReceiverAndDateAndNotificationType(User sender, User receiver, String date, NotificationType notificationType); | ||
|
||
List<Notification> findBySenderAndDateAndNotificationType(User sender, String date, NotificationType notificationType); | ||
} |
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
Oops, something went wrong.