//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Copy, Clone, Default, Debug, DeriveEntity)] pub struct Entity; impl EntityName for Entity { fn table_name(&self) -> &str { "gift_card_transactions" } } #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)] pub struct Model { pub id: String, pub gift_card_id: String, pub order_id: String, pub amount: i32, pub created_at: DateTimeWithTimeZone, pub is_taxable: Option, pub tax_rate: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] pub enum Column { Id, GiftCardId, OrderId, Amount, CreatedAt, IsTaxable, TaxRate, } #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] pub enum PrimaryKey { Id, } impl PrimaryKeyTrait for PrimaryKey { type ValueType = String; fn auto_increment() -> bool { false } } #[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation { GiftCards, Orders, } impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::Id => ColumnType::String(None).def(), Self::GiftCardId => ColumnType::String(None).def(), Self::OrderId => ColumnType::String(None).def(), Self::Amount => ColumnType::Integer.def(), Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), Self::IsTaxable => ColumnType::Boolean.def().null(), Self::TaxRate => ColumnType::Float.def().null(), } } } impl RelationTrait for Relation { fn def(&self) -> RelationDef { match self { Self::GiftCards => Entity::belongs_to(super::gift_cards::Entity) .from(Column::GiftCardId) .to(super::gift_cards::Column::Id) .into(), Self::Orders => Entity::belongs_to(super::orders::Entity) .from(Column::OrderId) .to(super::orders::Column::Id) .into(), } } } impl Related for Entity { fn to() -> RelationDef { Relation::GiftCards.def() } } impl Related for Entity { fn to() -> RelationDef { Relation::Orders.def() } } impl ActiveModelBehavior for ActiveModel {}