//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use super::sea_orm_active_enums::{DiscountConditionOperators, DiscountConditionTypes}; #[derive(Copy, Clone, Default, Debug, DeriveEntity)] pub struct Entity; impl EntityName for Entity { fn table_name(&self) -> &str { "discount_conditions" } } #[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] pub struct Model { pub id: String, pub r#type: DiscountConditionTypes, pub operator: DiscountConditionOperators, pub discount_rule_id: String, pub created_at: DateTimeWithTimeZone, pub updated_at: DateTimeWithTimeZone, pub deleted_at: Option, pub metadata: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] pub enum Column { Id, Type, Operator, DiscountRuleId, CreatedAt, UpdatedAt, DeletedAt, Metadata, } #[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 { DiscountRules, } impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::Id => ColumnType::String(None).def(), Self::Type => DiscountConditionTypes::db_type().def(), Self::Operator => DiscountConditionOperators::db_type().def(), Self::DiscountRuleId => ColumnType::String(None).def(), Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), Self::Metadata => ColumnType::JsonBinary.def().null(), } } } impl RelationTrait for Relation { fn def(&self) -> RelationDef { match self { Self::DiscountRules => Entity::belongs_to(super::discount_rules::Entity) .from(Column::DiscountRuleId) .to(super::discount_rules::Column::Id) .into(), } } } impl Related for Entity { fn to() -> RelationDef { Relation::DiscountRules.def() } } impl Related for Entity { fn to() -> RelationDef { super::discount_condition_product_tags::Relation::ProductTags.def() } fn via() -> Option { Some( super::discount_condition_product_tags::Relation::DiscountConditions .def() .rev(), ) } } impl Related for Entity { fn to() -> RelationDef { super::discount_condition_customer_groups::Relation::CustomerGroups.def() } fn via() -> Option { Some( super::discount_condition_customer_groups::Relation::DiscountConditions .def() .rev(), ) } } impl Related for Entity { fn to() -> RelationDef { super::discount_condition_product_types::Relation::ProductTypes.def() } fn via() -> Option { Some( super::discount_condition_product_types::Relation::DiscountConditions .def() .rev(), ) } } impl Related for Entity { fn to() -> RelationDef { super::discount_condition_product_collections::Relation::ProductCollections.def() } fn via() -> Option { Some( super::discount_condition_product_collections::Relation::DiscountConditions .def() .rev(), ) } } impl Related for Entity { fn to() -> RelationDef { super::discount_condition_products::Relation::Products.def() } fn via() -> Option { Some( super::discount_condition_products::Relation::DiscountConditions .def() .rev(), ) } } impl ActiveModelBehavior for ActiveModel {}