Make notification db representation more flexible
This commit is contained in:
parent
fed3ffb681
commit
3241128840
17 changed files with 197 additions and 175 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::db::{NotificationId, UserId};
|
||||
use crate::db::{NotificationId, NotificationKindId, UserId};
|
||||
use sea_orm::entity::prelude::*;
|
||||
use time::PrimitiveDateTime;
|
||||
|
||||
|
@ -7,13 +7,12 @@ use time::PrimitiveDateTime;
|
|||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: NotificationId,
|
||||
pub recipient_id: UserId,
|
||||
pub kind: i32,
|
||||
pub is_read: bool,
|
||||
pub created_at: PrimitiveDateTime,
|
||||
pub entity_id_1: Option<i32>,
|
||||
pub entity_id_2: Option<i32>,
|
||||
pub entity_id_3: Option<i32>,
|
||||
pub recipient_id: UserId,
|
||||
pub actor_id: Option<UserId>,
|
||||
pub kind: NotificationKindId,
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use crate::db::NotificationKindId;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
|
||||
#[sea_orm(table_name = "notification_kinds")]
|
||||
pub struct Model {
|
||||
#[sea_orm(primary_key)]
|
||||
pub id: i32,
|
||||
pub id: NotificationKindId,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue