web3-proxy/entities/src/admin.rs

42 lines
1.1 KiB
Rust
Raw Normal View History

//! `SeaORM` Entity. Generated by sea-orm-codegen 0.10.7
use sea_orm::entity::prelude::*;
2023-02-19 23:27:53 +03:00
use serde::{Deserialize, Serialize};
2023-02-19 23:27:53 +03:00
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "admin")]
pub struct Model {
#[sea_orm(primary_key)]
2023-02-19 23:27:53 +03:00
pub id: u64,
#[sea_orm(unique)]
pub user_id: u64,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::admin_increase_balance_receipt::Entity")]
AdminIncreaseBalanceReceipt,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
User,
}
impl Related<super::admin_increase_balance_receipt::Entity> for Entity {
fn to() -> RelationDef {
Relation::AdminIncreaseBalanceReceipt.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}