forked from alemi/upub
29 lines
580 B
Rust
29 lines
580 B
Rust
|
use sea_orm::entity::prelude::*;
|
||
|
|
||
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
|
||
|
#[sea_orm(table_name = "credentials")]
|
||
|
pub struct Model {
|
||
|
#[sea_orm(primary_key)]
|
||
|
pub id: String,
|
||
|
pub email: String,
|
||
|
pub password: String,
|
||
|
}
|
||
|
|
||
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||
|
pub enum Relation {
|
||
|
#[sea_orm(
|
||
|
belongs_to = "super::user::Entity",
|
||
|
from = "Column::Id",
|
||
|
to = "super::user::Column::Id"
|
||
|
)]
|
||
|
User,
|
||
|
}
|
||
|
|
||
|
impl Related<super::user::Entity> for Entity {
|
||
|
fn to() -> RelationDef {
|
||
|
Relation::User.def()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl ActiveModelBehavior for ActiveModel {}
|