use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "news_read_signal")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
pub news: Uuid,
pub done_at: TimeDateTimeWithTimeZone,
pub duration: i32,
pub scroll_depth_percentage: i8,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::news::Entity",
from = "Column::News",
to = "super::news::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
News,
}
impl Related<super::news::Entity> for Entity {
fn to() -> RelationDef {
Relation::News.def()
}
}
impl ActiveModelBehavior for ActiveModel {}