use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "bakery")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub name: String, pub profit_margin: f64, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm(has_many = "super::baker::Entity")] Baker, #[sea_orm(has_many = "super::order::Entity")] Order, #[sea_orm(has_many = "super::cake::Entity")] Cake, } impl Related for Entity { fn to() -> RelationDef { Relation::Baker.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::Order.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::Cake.def() } } impl ActiveModelBehavior for ActiveModel {}