@NoArgsConstructor
@Getter
@EntityListeners(AuditingEntityListener.class)
@Entity
@EnableJpaAuditing // @CreatedDate @ModifyDate 위해서 필요
public class Notification {
// PK
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "notification_id")
private Long id;
// FK
// 사용자의 id 연관관계
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "user_id")
private User user;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "study_room_id")
private StudyMember studyMember;
// FK
// 알림 내용
@Column(nullable = false)
private String message;
// 알림 발생 시간
@CreatedDate
@Column(nullable = false)
private LocalDateTime createAt;
@LastModifiedDate
@Column(nullable = false)
private LocalDateTime updateAt;
// 읽음 상태 (true / false)
@Column(nullable = false)
private boolean readStatus;
// 알림 유형 (그룹 리더로서의 알림인지, 사용자 관점에서의 알림인지 구분)
@Column(nullable = false)
private String type;
}