Files
no-copy/src/main/java/ru/soune/nocopy/entity/notification/Notification.java
T

50 lines
1.3 KiB
Java
Raw Normal View History

2026-03-31 15:31:59 +07:00
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;
2026-04-03 12:29:09 +07:00
@Enumerated(EnumType.STRING)
2026-03-31 15:31:59 +07:00
@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;
}