mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-21 13:28:57 +00:00
29 lines
723 B
Rust
29 lines
723 B
Rust
use sea_orm::entity::prelude::*;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
|
|
#[sea_orm(table_name = "admin")]
|
|
pub struct Model {
|
|
#[sea_orm(column_type = "Integer", primary_key)]
|
|
pub id: i32,
|
|
pub name: String,
|
|
pub public_key: String,
|
|
#[sea_orm(column_type = "Text")]
|
|
pub private_key: String,
|
|
pub password: String,
|
|
pub created_at: DateTime,
|
|
pub updated_at: DateTime,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(has_many = "super::session::Entity")]
|
|
Session,
|
|
}
|
|
|
|
impl Related<super::session::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Session.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|