1use crate::db::{NotificationId, 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 recipient_id: UserId,
11 pub kind: i32,
12 pub is_read: bool,
13 pub created_at: PrimitiveDateTime,
14 pub entity_id_1: Option<i32>,
15 pub entity_id_2: Option<i32>,
16 pub entity_id_3: Option<i32>,
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 {}