dev add notification entity
Test Workflow / test (push) Waiting to run

This commit is contained in:
vladp
2026-03-31 15:31:59 +07:00
parent ad4850414a
commit 9a3a8bde05
3 changed files with 72 additions and 0 deletions
@@ -0,0 +1,48 @@
package ru.soune.nocopy.entity.notification;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import ru.soune.nocopy.entity.user.User;
import java.time.LocalDateTime;
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Getter @Setter
@Builder
@Table(name = "notifications", indexes = {
@Index(name = "idx_user_status", columnList = "user_id, status"),
@Index(name = "idx_user_created", columnList = "user_id, created_at DESC")
})
public class Notification {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "created_at", updatable = false)
@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
@Column(name = "updated_at")
private LocalDateTime updatedAt;
@Column(name = "message")
private String message;
@Column(name = "notification_type")
private NotificationType notificationType;
@Column(name = "status")
private NotificationStatus status = NotificationStatus.NEW;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
@JsonIgnore
private User user;
}
@@ -0,0 +1,5 @@
package ru.soune.nocopy.entity.notification;
public enum NotificationStatus {
NEW, READIED
}
@@ -0,0 +1,19 @@
package ru.soune.nocopy.entity.notification;
public enum NotificationType{
SEARCH_RESULT,
MONITORING_RESULT,
OPERATION_IMPOSSIBLE,
START_FAILED_NOW,
START_FAILED_NEXT,
PAYOUT_RESULT,
REFERRAL_DEPOSIT,
REFERRAL_REGISTERED,
REFERRAL_ACTIVATED,
COMPLAINT_STATUS_CHANGED,
CASE_STATUS_CHANGED,
INCOMING_MESSAGE,
TARIFF_EXPIRING,
FILE_MODERATION_EVENT,
FILE_ADDED_TO_SYSTEM
}