//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0 use super::sea_orm_active_enums::ChannelType; use super::sea_orm_active_enums::NotificationStatus; use super::sea_orm_active_enums::TargetType; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize, Deserialize)] #[sea_orm(table_name = "notification")] #[sea_orm::model] #[serde(rename_all = "camelCase")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(unique_key = "UQ_notification_recipient_target_trigger_channel")] pub recipient_id: Uuid, #[sea_orm(unique_key = "UQ_notification_recipient_target_trigger_channel")] pub target_type: TargetType, #[sea_orm(unique_key = "UQ_notification_recipient_target_trigger_channel")] pub target_id: Uuid, #[sea_orm(unique_key = "UQ_notification_recipient_target_trigger_channel")] pub trigger_at: DateTimeWithTimeZone, #[sea_orm(unique_key = "UQ_notification_recipient_target_trigger_channel")] pub channel: ChannelType, pub status: NotificationStatus, pub locked_at: Option, pub sent_at: Option, pub read_at: Option, pub created_at: DateTimeWithTimeZone, pub updated_at: DateTimeWithTimeZone, pub offset_id: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(has_many = "super::delivery_log::Entity")] DeliveryLog, #[sea_orm( belongs_to = "super::user::Entity", from = "Column::RecipientId", to = "super::user::Column::Id", on_update = "Cascade", on_delete = "Cascade" )] User, } impl Related for Entity { fn to() -> RelationDef { Relation::DeliveryLog.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::User.def() } } impl ActiveModelBehavior for ActiveModel {}