use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "news_label")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: Uuid,
#[sea_orm(column_type = "Text", unique)]
pub name: String,
#[sea_orm(column_type = "Text", nullable)]
pub description: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::news_to_label_link::Entity")]
NewsToLabelLink,
}
impl Related<super::news_to_label_link::Entity> for Entity {
fn to() -> RelationDef {
Relation::NewsToLabelLink.def()
}
}
impl Related<super::news::Entity> for Entity {
fn to() -> RelationDef {
super::news_to_label_link::Relation::News.def()
}
fn via() -> Option<RelationDef> {
Some(super::news_to_label_link::Relation::NewsLabel.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}