Add the rest of the relations
This commit is contained in:
parent
d103671701
commit
c4fc1b1678
@ -38,6 +38,7 @@ impl PrimaryKeyTrait for PrimaryKey {
|
|||||||
pub enum Relation {
|
pub enum Relation {
|
||||||
Baker,
|
Baker,
|
||||||
Order,
|
Order,
|
||||||
|
Cake,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColumnTrait for Column {
|
impl ColumnTrait for Column {
|
||||||
@ -57,6 +58,7 @@ impl RelationTrait for Relation {
|
|||||||
match self {
|
match self {
|
||||||
Self::Baker => Entity::has_many(super::baker::Entity).into(),
|
Self::Baker => Entity::has_many(super::baker::Entity).into(),
|
||||||
Self::Order => Entity::has_many(super::order::Entity).into(),
|
Self::Order => Entity::has_many(super::order::Entity).into(),
|
||||||
|
Self::Cake => Entity::has_many(super::cake::Entity).into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,4 +69,16 @@ impl Related<super::baker::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Related<super::order::Entity> for Entity {
|
||||||
|
fn to() -> RelationDef {
|
||||||
|
Relation::Order.def()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Related<super::cake::Entity> for Entity {
|
||||||
|
fn to() -> RelationDef {
|
||||||
|
Relation::Cake.def()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
@ -98,4 +98,10 @@ impl Related<super::baker::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Related<super::lineitem::Entity> for Entity {
|
||||||
|
fn to() -> RelationDef {
|
||||||
|
Relation::Lineitem.def()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
@ -39,6 +39,7 @@ impl PrimaryKeyTrait for PrimaryKey {
|
|||||||
#[derive(Copy, Clone, Debug, EnumIter)]
|
#[derive(Copy, Clone, Debug, EnumIter)]
|
||||||
pub enum Relation {
|
pub enum Relation {
|
||||||
Order,
|
Order,
|
||||||
|
Cake,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ColumnTrait for Column {
|
impl ColumnTrait for Column {
|
||||||
@ -61,6 +62,10 @@ impl RelationTrait for Relation {
|
|||||||
.from(Column::Id)
|
.from(Column::Id)
|
||||||
.to(super::order::Column::CustomerId)
|
.to(super::order::Column::CustomerId)
|
||||||
.into(),
|
.into(),
|
||||||
|
Self::Cake => Entity::belongs_to(super::cake::Entity)
|
||||||
|
.from(Column::Id)
|
||||||
|
.to(super::cake::Column::LineitemId)
|
||||||
|
.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,4 +76,10 @@ impl Related<super::order::Entity> for Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Related<super::cake::Entity> for Entity {
|
||||||
|
fn to() -> RelationDef {
|
||||||
|
Relation::Cake.def()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user