magnetar/ext_calckey_model/entity_ck/src/entities/notification.rs

116 lines
3.4 KiB
Rust
Raw Normal View History

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
use super::sea_orm_active_enums::NotificationTypeEnum;
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "notification")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "notifieeId")]
pub notifiee_id: String,
#[sea_orm(column_name = "notifierId")]
pub notifier_id: Option<String>,
#[sea_orm(column_name = "isRead")]
pub is_read: bool,
#[sea_orm(column_name = "noteId")]
pub note_id: Option<String>,
pub reaction: Option<String>,
pub choice: Option<i32>,
#[sea_orm(column_name = "followRequestId")]
pub follow_request_id: Option<String>,
pub r#type: NotificationTypeEnum,
#[sea_orm(column_name = "userGroupInvitationId")]
pub user_group_invitation_id: Option<String>,
#[sea_orm(column_name = "customBody")]
pub custom_body: Option<String>,
#[sea_orm(column_name = "customHeader")]
pub custom_header: Option<String>,
#[sea_orm(column_name = "customIcon")]
pub custom_icon: Option<String>,
#[sea_orm(column_name = "appAccessTokenId")]
pub app_access_token_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::access_token::Entity",
from = "Column::AppAccessTokenId",
to = "super::access_token::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
AccessToken,
#[sea_orm(
belongs_to = "super::follow_request::Entity",
from = "Column::FollowRequestId",
to = "super::follow_request::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
FollowRequest,
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::NotifierId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User2,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::NotifieeId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User1,
#[sea_orm(
belongs_to = "super::user_group_invitation::Entity",
from = "Column::UserGroupInvitationId",
to = "super::user_group_invitation::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
UserGroupInvitation,
}
impl Related<super::access_token::Entity> for Entity {
fn to() -> RelationDef {
Relation::AccessToken.def()
}
}
impl Related<super::follow_request::Entity> for Entity {
fn to() -> RelationDef {
Relation::FollowRequest.def()
}
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl Related<super::user_group_invitation::Entity> for Entity {
fn to() -> RelationDef {
Relation::UserGroupInvitation.def()
}
}
impl ActiveModelBehavior for ActiveModel {}