#[cfg(feature="sea-orm")]
use sea_orm::entity::prelude::*;
#[cfg_attr(feature="sea-orm",derive(DeriveEntityModel))]
#[cfg_attr(feature="serde",derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature="sea-orm",sea_orm(table_name = "bank_account"))]
pub struct Model {
#[cfg_attr(feature="sea-orm",sea_orm(primary_key))]
pub id: i32,
pub user_id: i32,
#[cfg_attr(feature="sea-orm",sea_orm(column_type = "Text"))]
pub account_number: String,
#[cfg_attr(feature="sea-orm",sea_orm(column_type = "Text"))]
pub name: String,
}
#[cfg(feature="sea-orm")]
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::transaction::Entity")]
Transaction,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "NoAction"
)]
User,
}
#[cfg(feature="sea-orm")]
impl Related<super::transaction::Entity> for Entity {
fn to() -> RelationDef {
Relation::Transaction.def()
}
}
#[cfg(feature="sea-orm")]
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
#[cfg(feature="sea-orm")]
impl ActiveModelBehavior for ActiveModel {}