You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.0
|
|
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "transaction")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: i32,
|
|
pub company_id: i32,
|
|
#[sea_orm(unique)]
|
|
pub foreign_id: String,
|
|
pub date_published: Date,
|
|
pub date_executed: Date,
|
|
#[sea_orm(column_type = "Text")]
|
|
pub person: String,
|
|
pub exchange: String,
|
|
pub nature: String,
|
|
pub isin: Option<String>,
|
|
pub instrument: String,
|
|
pub volume: i32,
|
|
#[sea_orm(column_type = "Float")]
|
|
pub unit_price: f32,
|
|
pub created_at_utc: DateTime,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::company::Entity",
|
|
from = "Column::CompanyId",
|
|
to = "super::company::Column::Id",
|
|
on_update = "Cascade",
|
|
on_delete = "Cascade"
|
|
)]
|
|
Company,
|
|
}
|
|
|
|
impl Related<super::company::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Company.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|