mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-08 20:40:46 +00:00
feat: candidate & parent relations
This commit is contained in:
parent
0e154ae3f9
commit
03a9268848
2 changed files with 22 additions and 1 deletions
|
|
@ -35,10 +35,18 @@ pub struct Model {
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
pub enum Relation {
|
pub enum Relation {
|
||||||
|
#[sea_orm(has_one = "super::parent::Entity")]
|
||||||
|
Parent,
|
||||||
#[sea_orm(has_many = "super::session::Entity")]
|
#[sea_orm(has_many = "super::session::Entity")]
|
||||||
Session,
|
Session,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Related<super::parent::Entity> for Entity {
|
||||||
|
fn to() -> RelationDef {
|
||||||
|
Relation::Parent.def()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Related<super::session::Entity> for Entity {
|
impl Related<super::session::Entity> for Entity {
|
||||||
fn to() -> RelationDef {
|
fn to() -> RelationDef {
|
||||||
Relation::Session.def()
|
Relation::Session.def()
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,19 @@ pub struct Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
pub enum Relation {}
|
pub enum Relation {
|
||||||
|
#[sea_orm(
|
||||||
|
belongs_to = "super::candidate::Entity",
|
||||||
|
from = "Column::Application",
|
||||||
|
to = "super::candidate::Column::Application"
|
||||||
|
)]
|
||||||
|
Candidate,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Related<super::candidate::Entity> for Entity {
|
||||||
|
fn to() -> RelationDef {
|
||||||
|
Relation::Candidate.def()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl ActiveModelBehavior for ActiveModel {}
|
impl ActiveModelBehavior for ActiveModel {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue