(toggl-portal): Add project <-> time_entry fk relation
This commit is contained in:
@@ -28,6 +28,8 @@ pub enum Relation {
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Client,
|
||||
#[sea_orm(has_many = "super::time_entry::Entity")]
|
||||
TimeEntry,
|
||||
}
|
||||
|
||||
impl Related<super::client::Entity> for Entity {
|
||||
@@ -36,4 +38,10 @@ impl Related<super::client::Entity> for Entity {
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::time_entry::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::TimeEntry.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
||||
@@ -19,6 +19,21 @@ pub struct Model {
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {}
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::project::Entity",
|
||||
from = "Column::ProjectId",
|
||||
to = "super::project::Column::TogglId",
|
||||
on_update = "NoAction",
|
||||
on_delete = "NoAction"
|
||||
)]
|
||||
Project,
|
||||
}
|
||||
|
||||
impl Related<super::project::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Project.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
||||
|
||||
Reference in New Issue
Block a user