You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
977 B
Rust
41 lines
977 B
Rust
3 years ago
|
use sea_orm::prelude::*;
|
||
|
|
||
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
||
3 years ago
|
#[sea_orm(table_name = "cd_source_mappings")]
|
||
3 years ago
|
pub struct Model {
|
||
|
#[sea_orm(primary_key)]
|
||
3 years ago
|
pub cd_id: i64,
|
||
3 years ago
|
#[sea_orm(primary_key)]
|
||
3 years ago
|
pub source_id: i64,
|
||
3 years ago
|
}
|
||
|
|
||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||
|
pub enum Relation {
|
||
3 years ago
|
#[sea_orm(
|
||
3 years ago
|
belongs_to = "super::content_descriptor::Entity",
|
||
|
from = "Column::CdId",
|
||
|
to = "super::content_descriptor::Column::Id"
|
||
3 years ago
|
)]
|
||
3 years ago
|
ContentDescriptorId,
|
||
3 years ago
|
#[sea_orm(
|
||
|
belongs_to = "super::source::Entity",
|
||
|
from = "Column::SourceId",
|
||
|
to = "super::source::Column::Id"
|
||
|
)]
|
||
3 years ago
|
Source,
|
||
|
}
|
||
|
|
||
3 years ago
|
impl Related<super::content_descriptor::Entity> for Entity {
|
||
3 years ago
|
fn to() -> RelationDef {
|
||
3 years ago
|
Relation::ContentDescriptorId.def()
|
||
3 years ago
|
}
|
||
|
}
|
||
|
|
||
|
impl Related<super::source::Entity> for Entity {
|
||
|
fn to() -> RelationDef {
|
||
|
Relation::Source.def()
|
||
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
impl ActiveModelBehavior for ActiveModel {}
|