basic structure for notification system
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package SuMoC.backend.notification.models;
|
||||
|
||||
import SuMoC.backend.notification.enums.NotificationStatus;
|
||||
import SuMoC.backend.user.models.User;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "notifications")
|
||||
@Getter
|
||||
@Setter
|
||||
public class Notification {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id", nullable = false)
|
||||
private User user;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Time of day from which on a notification might be sent.
|
||||
* Useful since we might want to send messages about specific trips immediately but not inform about trend changes
|
||||
* etc. in the middle of night when calculating jobs might run.
|
||||
*/
|
||||
@Column(nullable = false)
|
||||
private LocalTime earliestTimeOfDayToSend;
|
||||
|
||||
@Column(nullable = false)
|
||||
private NotificationStatus status;
|
||||
|
||||
@Column(nullable = false)
|
||||
private int retryCount;
|
||||
|
||||
@Column(nullable = false)
|
||||
private LocalDateTime createdAt;
|
||||
}
|
||||
Reference in New Issue
Block a user