as_core 0.1.0

aspiesolutions core crate
Documentation
#[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))]
#[cfg_attr(feature="sea-orm",sea_orm(table_name = "transaction"))]
#[derive(Clone, Debug, PartialEq,  Eq)]
pub struct Model {
    #[cfg_attr(feature="sea-orm",sea_orm(primary_key))]
    pub id: i32,
    #[cfg_attr(feature="sea-orm",sea_orm(column_type = "Text"))]
    pub description: String,
    pub user_id: i32,
    pub amount: rust_decimal::Decimal,
    pub bank_account: i32,
    pub method: TransactionMethod,
    pub purpose: TransactionPurpose,
    pub vendor: TransactionVendor,
    pub date_time: chrono::DateTime<chrono::FixedOffset>,
}
#[cfg_attr(feature="sea-orm",derive(EnumIter, DeriveRelation))]
#[derive(Copy, Clone, Debug)]
pub enum Relation {
    #[cfg_attr(feature="sea-orm",sea_orm(
        belongs_to = "super::bank_account::Entity",
        from = "Column::UserId",
        to = "super::bank_account::Column::Id",
        on_update = "NoAction",
        on_delete = "NoAction"
    ))]
    BankAccount,
    #[cfg_attr(feature="sea-orm",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::bank_account::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::BankAccount.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 {}


#[cfg_attr(feature="sea-orm",derive(EnumIter, DeriveActiveEnum))]
#[cfg_attr(feature="serde",derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature="rocket",derive(rocket::FromFormField))]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature="sea-orm",sea_orm(rs_type = "String", db_type = "Enum", enum_name = "transaction_method"))]
pub enum TransactionMethod {
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "ach"))]
    Ach,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "card"))]
    Card,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "cash"))]
    Cash,
}


#[cfg_attr(feature="sea-orm",derive(EnumIter, DeriveActiveEnum))]
#[cfg_attr(feature="serde",derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature="rocket",derive(rocket::FromFormField))]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature="sea-orm",sea_orm(
    rs_type = "String",
    db_type = "Enum",
    enum_name = "transaction_purpose"
))]
pub enum TransactionPurpose {
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "buisness"))]
    Buisness,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "personal"))]
    Personal,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "uncatagorized"))]
    Uncatagorized,
}
#[cfg_attr(feature="sea-orm",derive(EnumIter, DeriveActiveEnum))]
#[cfg_attr(feature="serde",derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature="rocket",derive(rocket::FromFormField))]
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature="sea-orm",sea_orm(rs_type = "String", db_type = "Enum", enum_name = "transaction_vendor"))]
pub enum TransactionVendor {
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "door_dash"))]
    DoorDash,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "lyft"))]
    Lyft,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "other"))]
    Other,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "uber"))]
    Uber,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "uber_eats"))]
    UberEats,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "uncategorized"))]
    Uncategorized,
    #[cfg_attr(feature="sea-orm",sea_orm(string_value = "walmart"))]
    Walmart,
}