1use crate::db::{NotificationId, NotificationKindId, UserId};
2use sea_orm::entity::prelude::*;
3use time::PrimitiveDateTime;
4
5#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
6#[sea_orm(table_name = "notifications")]
7pub struct Model {
8 #[sea_orm(primary_key)]
9 pub id: NotificationId,
10 pub created_at: PrimitiveDateTime,
11 pub recipient_id: UserId,
12 pub kind: NotificationKindId,
13 pub entity_id: Option<i32>,
14 pub content: String,
15 pub is_read: bool,
16 pub response: Option<bool>,
17}
18
19#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
20pub enum Relation {
21 #[sea_orm(
22 belongs_to = "super::user::Entity",
23 from = "Column::RecipientId",
24 to = "super::user::Column::Id"
25 )]
26 Recipient,
27}
28
29impl ActiveModelBehavior for ActiveModel {}