From 25732c85118108e8a406aa372b88fa889705ece1 Mon Sep 17 00:00:00 2001 From: eraden Date: Mon, 12 Jun 2023 15:11:59 +0200 Subject: [PATCH] Finish items and shipping --- crates/model/src/v4/mod.rs | 200 ++++---- crates/model/src/v4/prelude.rs | 196 ++++---- .../model/src/v4/product_category_products.rs | 28 -- crates/model/src/v4/product_collections.rs | 97 +++- crates/model/src/v4/product_images.rs | 84 +++- crates/model/src/v4/product_option_values.rs | 101 +++- crates/model/src/v4/product_options.rs | 97 +++- crates/model/src/v4/product_sales_channels.rs | 84 +++- crates/model/src/v4/product_tags.rs | 93 +++- crates/model/src/v4/product_tax_rates.rs | 93 +++- crates/model/src/v4/product_to_tags.rs | 84 +++- crates/model/src/v4/product_type_tax_rates.rs | 93 +++- crates/model/src/v4/product_types.rs | 107 +++- .../src/v4/product_variant_inventory_items.rs | 74 ++- crates/model/src/v4/product_variants.rs | 169 ++++++- crates/model/src/v4/products.rs | 255 +++++++++- .../v4/publishable_api_key_sales_channels.rs | 60 ++- crates/model/src/v4/publishable_api_keys.rs | 74 ++- crates/model/src/v4/refunds.rs | 107 +++- .../src/v4/region_fulfillment_providers.rs | 84 +++- .../model/src/v4/region_payment_providers.rs | 84 +++- crates/model/src/v4/regions.rs | 212 +++++++- crates/model/src/v4/return_items.rs | 116 ++++- crates/model/src/v4/return_reasons.rs | 95 +++- crates/model/src/v4/returns.rs | 146 +++++- .../model/src/v4/sales_channel_locations.rs | 71 ++- crates/model/src/v4/sales_channels.rs | 116 ++++- crates/model/src/v4/sea_orm_active_enums.rs | 458 ++++++++++++++++-- .../model/src/v4/shipping_method_tax_lines.rs | 90 +++- crates/model/src/v4/shipping_methods.rs | 158 +++++- .../src/v4/shipping_option_requirements.rs | 81 +++- crates/model/src/v4/shipping_options.rs | 171 ++++++- crates/model/src/v4/shipping_profiles.rs | 92 +++- crates/model/src/v4/shipping_tax_rates.rs | 93 +++- crates/model/src/v4/staged_jobs.rs | 65 ++- crates/model/src/v4/store_currencies.rs | 84 +++- crates/model/src/v4/stores.rs | 113 ++++- crates/model/src/v4/swaps.rs | 176 ++++++- crates/model/src/v4/tax_providers.rs | 69 ++- crates/model/src/v4/tax_rates.rs | 121 ++++- crates/model/src/v4/tracking_links.rs | 93 +++- crates/model/src/v4/users.rs | 96 +++- .../src/checkouts/m20230603_120815_items.rs | 7 +- migration/src/sea_ext/mod.rs | 21 +- .../src/shipping/m20230603_120810_shipping.rs | 211 ++++++-- 45 files changed, 4316 insertions(+), 903 deletions(-) diff --git a/crates/model/src/v4/mod.rs b/crates/model/src/v4/mod.rs index be2047c..e1b722d 100644 --- a/crates/model/src/v4/mod.rs +++ b/crates/model/src/v4/mod.rs @@ -1,103 +1,103 @@ //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 -pub mod prelude ; +pub mod prelude; -pub mod addresses ; -pub mod analytics_configs ; -pub mod batch_jobs ; -pub mod cart_discounts ; -pub mod cart_gift_cards ; -pub mod carts ; -pub mod claim_images ; -pub mod claim_item_tags ; -pub mod claim_items ; -pub mod claim_orders ; -pub mod claim_tags ; -pub mod countries ; -pub mod currencies ; -pub mod custom_shipping_options ; -pub mod customer_group_customers ; -pub mod customer_groups ; -pub mod customers ; -pub mod discount_condition_customer_groups ; -pub mod discount_condition_product_collections ; -pub mod discount_condition_product_tags ; -pub mod discount_condition_product_types ; -pub mod discount_condition_products ; -pub mod discount_conditions ; -pub mod discount_regions ; -pub mod discount_rule_products ; -pub mod discount_rules ; -pub mod discounts ; -pub mod draft_orders ; -pub mod fulfillment_items ; -pub mod fulfillment_providers ; -pub mod fulfillments ; -pub mod gift_card_transactions ; -pub mod gift_cards ; -pub mod idempotency_keys ; -pub mod images ; -pub mod invites ; -pub mod line_item_adjustments ; -pub mod line_item_tax_lines ; -pub mod line_items ; -pub mod migrations ; -pub mod money_amounts ; -pub mod notes ; -pub mod notification_providers ; -pub mod notifications ; -pub mod oauth ; -pub mod order_discounts ; -pub mod order_edits ; -pub mod order_gift_cards ; -pub mod order_item_changes ; -pub mod orders ; -pub mod payment_collection_payments ; -pub mod payment_collection_sessions ; -pub mod payment_collections ; -pub mod payment_providers ; -pub mod payment_sessions ; -pub mod payments ; -pub mod price_list_customer_groups ; -pub mod price_lists ; -pub mod product_categories ; -pub mod product_category_products ; -pub mod product_collections ; -pub mod product_images ; -pub mod product_option_values ; -pub mod product_options ; -pub mod product_sales_channels ; -pub mod product_tags ; -pub mod product_tax_rates ; -pub mod product_to_tags ; -pub mod product_type_tax_rates ; -pub mod product_types ; -pub mod product_variant_inventory_items ; -pub mod product_variants ; -pub mod products ; -pub mod publishable_api_key_sales_channels ; -pub mod publishable_api_keys ; -pub mod refunds ; -pub mod region_fulfillment_providers ; -pub mod region_payment_providers ; -pub mod regions ; -pub mod return_items ; -pub mod return_reasons ; -pub mod returns ; -pub mod sales_channel_locations ; -pub mod sales_channels ; -pub mod shipping_method_tax_lines ; -pub mod shipping_methods ; -pub mod shipping_option_requirements ; -pub mod shipping_options ; -pub mod shipping_profiles ; -pub mod shipping_tax_rates ; -pub mod staged_jobs ; -pub mod store_currencies ; -pub mod stores ; -pub mod swaps ; -pub mod tax_providers ; -pub mod tax_rates ; -pub mod tracking_links ; -pub mod users ; -pub mod sea_orm_active_enums ; \ No newline at end of file +pub mod addresses; +pub mod analytics_configs; +pub mod batch_jobs; +pub mod cart_discounts; +pub mod cart_gift_cards; +pub mod carts; +pub mod claim_images; +pub mod claim_item_tags; +pub mod claim_items; +pub mod claim_orders; +pub mod claim_tags; +pub mod countries; +pub mod currencies; +pub mod custom_shipping_options; +pub mod customer_group_customers; +pub mod customer_groups; +pub mod customers; +pub mod discount_condition_customer_groups; +pub mod discount_condition_product_collections; +pub mod discount_condition_product_tags; +pub mod discount_condition_product_types; +pub mod discount_condition_products; +pub mod discount_conditions; +pub mod discount_regions; +pub mod discount_rule_products; +pub mod discount_rules; +pub mod discounts; +pub mod draft_orders; +pub mod fulfillment_items; +pub mod fulfillment_providers; +pub mod fulfillments; +pub mod gift_card_transactions; +pub mod gift_cards; +pub mod idempotency_keys; +pub mod images; +pub mod invites; +pub mod line_item_adjustments; +pub mod line_item_tax_lines; +pub mod line_items; +pub mod migrations; +pub mod money_amounts; +pub mod notes; +pub mod notification_providers; +pub mod notifications; +pub mod oauth; +pub mod order_discounts; +pub mod order_edits; +pub mod order_gift_cards; +pub mod order_item_changes; +pub mod orders; +pub mod payment_collection_payments; +pub mod payment_collection_sessions; +pub mod payment_collections; +pub mod payment_providers; +pub mod payment_sessions; +pub mod payments; +pub mod price_list_customer_groups; +pub mod price_lists; +pub mod product_categories; +pub mod product_category_products; +pub mod product_collections; +pub mod product_images; +pub mod product_option_values; +pub mod product_options; +pub mod product_sales_channels; +pub mod product_tags; +pub mod product_tax_rates; +pub mod product_to_tags; +pub mod product_type_tax_rates; +pub mod product_types; +pub mod product_variant_inventory_items; +pub mod product_variants; +pub mod products; +pub mod publishable_api_key_sales_channels; +pub mod publishable_api_keys; +pub mod refunds; +pub mod region_fulfillment_providers; +pub mod region_payment_providers; +pub mod regions; +pub mod return_items; +pub mod return_reasons; +pub mod returns; +pub mod sales_channel_locations; +pub mod sales_channels; +pub mod sea_orm_active_enums; +pub mod shipping_method_tax_lines; +pub mod shipping_methods; +pub mod shipping_option_requirements; +pub mod shipping_options; +pub mod shipping_profiles; +pub mod shipping_tax_rates; +pub mod staged_jobs; +pub mod store_currencies; +pub mod stores; +pub mod swaps; +pub mod tax_providers; +pub mod tax_rates; +pub mod tracking_links; +pub mod users; diff --git a/crates/model/src/v4/prelude.rs b/crates/model/src/v4/prelude.rs index 57a5f36..06ffaf3 100644 --- a/crates/model/src/v4/prelude.rs +++ b/crates/model/src/v4/prelude.rs @@ -1,100 +1,100 @@ //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 -pub use super :: addresses :: Entity as Addresses ; -pub use super :: analytics_configs :: Entity as AnalyticsConfigs ; -pub use super :: batch_jobs :: Entity as BatchJobs ; -pub use super :: cart_discounts :: Entity as CartDiscounts ; -pub use super :: cart_gift_cards :: Entity as CartGiftCards ; -pub use super :: carts :: Entity as Carts ; -pub use super :: claim_images :: Entity as ClaimImages ; -pub use super :: claim_item_tags :: Entity as ClaimItemTags ; -pub use super :: claim_items :: Entity as ClaimItems ; -pub use super :: claim_orders :: Entity as ClaimOrders ; -pub use super :: claim_tags :: Entity as ClaimTags ; -pub use super :: countries :: Entity as Countries ; -pub use super :: currencies :: Entity as Currencies ; -pub use super :: custom_shipping_options :: Entity as CustomShippingOptions ; -pub use super :: customer_group_customers :: Entity as CustomerGroupCustomers ; -pub use super :: customer_groups :: Entity as CustomerGroups ; -pub use super :: customers :: Entity as Customers ; -pub use super :: discount_condition_customer_groups :: Entity as DiscountConditionCustomerGroups ; -pub use super :: discount_condition_product_collections :: Entity as DiscountConditionProductCollections ; -pub use super :: discount_condition_product_tags :: Entity as DiscountConditionProductTags ; -pub use super :: discount_condition_product_types :: Entity as DiscountConditionProductTypes ; -pub use super :: discount_condition_products :: Entity as DiscountConditionProducts ; -pub use super :: discount_conditions :: Entity as DiscountConditions ; -pub use super :: discount_regions :: Entity as DiscountRegions ; -pub use super :: discount_rule_products :: Entity as DiscountRuleProducts ; -pub use super :: discount_rules :: Entity as DiscountRules ; -pub use super :: discounts :: Entity as Discounts ; -pub use super :: draft_orders :: Entity as DraftOrders ; -pub use super :: fulfillment_items :: Entity as FulfillmentItems ; -pub use super :: fulfillment_providers :: Entity as FulfillmentProviders ; -pub use super :: fulfillments :: Entity as Fulfillments ; -pub use super :: gift_card_transactions :: Entity as GiftCardTransactions ; -pub use super :: gift_cards :: Entity as GiftCards ; -pub use super :: idempotency_keys :: Entity as IdempotencyKeys ; -pub use super :: images :: Entity as Images ; -pub use super :: invites :: Entity as Invites ; -pub use super :: line_item_adjustments :: Entity as LineItemAdjustments ; -pub use super :: line_item_tax_lines :: Entity as LineItemTaxLines ; -pub use super :: line_items :: Entity as LineItems ; -pub use super :: migrations :: Entity as Migrations ; -pub use super :: money_amounts :: Entity as MoneyAmounts ; -pub use super :: notes :: Entity as Notes ; -pub use super :: notification_providers :: Entity as NotificationProviders ; -pub use super :: notifications :: Entity as Notifications ; -pub use super :: oauth :: Entity as Oauth ; -pub use super :: order_discounts :: Entity as OrderDiscounts ; -pub use super :: order_edits :: Entity as OrderEdits ; -pub use super :: order_gift_cards :: Entity as OrderGiftCards ; -pub use super :: order_item_changes :: Entity as OrderItemChanges ; -pub use super :: orders :: Entity as Orders ; -pub use super :: payment_collection_payments :: Entity as PaymentCollectionPayments ; -pub use super :: payment_collection_sessions :: Entity as PaymentCollectionSessions ; -pub use super :: payment_collections :: Entity as PaymentCollections ; -pub use super :: payment_providers :: Entity as PaymentProviders ; -pub use super :: payment_sessions :: Entity as PaymentSessions ; -pub use super :: payments :: Entity as Payments ; -pub use super :: price_list_customer_groups :: Entity as PriceListCustomerGroups ; -pub use super :: price_lists :: Entity as PriceLists ; -pub use super :: product_categories :: Entity as ProductCategories ; -pub use super :: product_category_products :: Entity as ProductCategoryProducts ; -pub use super :: product_collections :: Entity as ProductCollections ; -pub use super :: product_images :: Entity as ProductImages ; -pub use super :: product_option_values :: Entity as ProductOptionValues ; -pub use super :: product_options :: Entity as ProductOptions ; -pub use super :: product_sales_channels :: Entity as ProductSalesChannels ; -pub use super :: product_tags :: Entity as ProductTags ; -pub use super :: product_tax_rates :: Entity as ProductTaxRates ; -pub use super :: product_to_tags :: Entity as ProductToTags ; -pub use super :: product_type_tax_rates :: Entity as ProductTypeTaxRates ; -pub use super :: product_types :: Entity as ProductTypes ; -pub use super :: product_variant_inventory_items :: Entity as ProductVariantInventoryItems ; -pub use super :: product_variants :: Entity as ProductVariants ; -pub use super :: products :: Entity as Products ; -pub use super :: publishable_api_key_sales_channels :: Entity as PublishableApiKeySalesChannels ; -pub use super :: publishable_api_keys :: Entity as PublishableApiKeys ; -pub use super :: refunds :: Entity as Refunds ; -pub use super :: region_fulfillment_providers :: Entity as RegionFulfillmentProviders ; -pub use super :: region_payment_providers :: Entity as RegionPaymentProviders ; -pub use super :: regions :: Entity as Regions ; -pub use super :: return_items :: Entity as ReturnItems ; -pub use super :: return_reasons :: Entity as ReturnReasons ; -pub use super :: returns :: Entity as Returns ; -pub use super :: sales_channel_locations :: Entity as SalesChannelLocations ; -pub use super :: sales_channels :: Entity as SalesChannels ; -pub use super :: shipping_method_tax_lines :: Entity as ShippingMethodTaxLines ; -pub use super :: shipping_methods :: Entity as ShippingMethods ; -pub use super :: shipping_option_requirements :: Entity as ShippingOptionRequirements ; -pub use super :: shipping_options :: Entity as ShippingOptions ; -pub use super :: shipping_profiles :: Entity as ShippingProfiles ; -pub use super :: shipping_tax_rates :: Entity as ShippingTaxRates ; -pub use super :: staged_jobs :: Entity as StagedJobs ; -pub use super :: store_currencies :: Entity as StoreCurrencies ; -pub use super :: stores :: Entity as Stores ; -pub use super :: swaps :: Entity as Swaps ; -pub use super :: tax_providers :: Entity as TaxProviders ; -pub use super :: tax_rates :: Entity as TaxRates ; -pub use super :: tracking_links :: Entity as TrackingLinks ; -pub use super :: users :: Entity as Users ; \ No newline at end of file +pub use super::addresses::Entity as Addresses; +pub use super::analytics_configs::Entity as AnalyticsConfigs; +pub use super::batch_jobs::Entity as BatchJobs; +pub use super::cart_discounts::Entity as CartDiscounts; +pub use super::cart_gift_cards::Entity as CartGiftCards; +pub use super::carts::Entity as Carts; +pub use super::claim_images::Entity as ClaimImages; +pub use super::claim_item_tags::Entity as ClaimItemTags; +pub use super::claim_items::Entity as ClaimItems; +pub use super::claim_orders::Entity as ClaimOrders; +pub use super::claim_tags::Entity as ClaimTags; +pub use super::countries::Entity as Countries; +pub use super::currencies::Entity as Currencies; +pub use super::custom_shipping_options::Entity as CustomShippingOptions; +pub use super::customer_group_customers::Entity as CustomerGroupCustomers; +pub use super::customer_groups::Entity as CustomerGroups; +pub use super::customers::Entity as Customers; +pub use super::discount_condition_customer_groups::Entity as DiscountConditionCustomerGroups; +pub use super::discount_condition_product_collections::Entity as DiscountConditionProductCollections; +pub use super::discount_condition_product_tags::Entity as DiscountConditionProductTags; +pub use super::discount_condition_product_types::Entity as DiscountConditionProductTypes; +pub use super::discount_condition_products::Entity as DiscountConditionProducts; +pub use super::discount_conditions::Entity as DiscountConditions; +pub use super::discount_regions::Entity as DiscountRegions; +pub use super::discount_rule_products::Entity as DiscountRuleProducts; +pub use super::discount_rules::Entity as DiscountRules; +pub use super::discounts::Entity as Discounts; +pub use super::draft_orders::Entity as DraftOrders; +pub use super::fulfillment_items::Entity as FulfillmentItems; +pub use super::fulfillment_providers::Entity as FulfillmentProviders; +pub use super::fulfillments::Entity as Fulfillments; +pub use super::gift_card_transactions::Entity as GiftCardTransactions; +pub use super::gift_cards::Entity as GiftCards; +pub use super::idempotency_keys::Entity as IdempotencyKeys; +pub use super::images::Entity as Images; +pub use super::invites::Entity as Invites; +pub use super::line_item_adjustments::Entity as LineItemAdjustments; +pub use super::line_item_tax_lines::Entity as LineItemTaxLines; +pub use super::line_items::Entity as LineItems; +pub use super::migrations::Entity as Migrations; +pub use super::money_amounts::Entity as MoneyAmounts; +pub use super::notes::Entity as Notes; +pub use super::notification_providers::Entity as NotificationProviders; +pub use super::notifications::Entity as Notifications; +pub use super::oauth::Entity as Oauth; +pub use super::order_discounts::Entity as OrderDiscounts; +pub use super::order_edits::Entity as OrderEdits; +pub use super::order_gift_cards::Entity as OrderGiftCards; +pub use super::order_item_changes::Entity as OrderItemChanges; +pub use super::orders::Entity as Orders; +pub use super::payment_collection_payments::Entity as PaymentCollectionPayments; +pub use super::payment_collection_sessions::Entity as PaymentCollectionSessions; +pub use super::payment_collections::Entity as PaymentCollections; +pub use super::payment_providers::Entity as PaymentProviders; +pub use super::payment_sessions::Entity as PaymentSessions; +pub use super::payments::Entity as Payments; +pub use super::price_list_customer_groups::Entity as PriceListCustomerGroups; +pub use super::price_lists::Entity as PriceLists; +pub use super::product_categories::Entity as ProductCategories; +pub use super::product_category_products::Entity as ProductCategoryProducts; +pub use super::product_collections::Entity as ProductCollections; +pub use super::product_images::Entity as ProductImages; +pub use super::product_option_values::Entity as ProductOptionValues; +pub use super::product_options::Entity as ProductOptions; +pub use super::product_sales_channels::Entity as ProductSalesChannels; +pub use super::product_tags::Entity as ProductTags; +pub use super::product_tax_rates::Entity as ProductTaxRates; +pub use super::product_to_tags::Entity as ProductToTags; +pub use super::product_type_tax_rates::Entity as ProductTypeTaxRates; +pub use super::product_types::Entity as ProductTypes; +pub use super::product_variant_inventory_items::Entity as ProductVariantInventoryItems; +pub use super::product_variants::Entity as ProductVariants; +pub use super::products::Entity as Products; +pub use super::publishable_api_key_sales_channels::Entity as PublishableApiKeySalesChannels; +pub use super::publishable_api_keys::Entity as PublishableApiKeys; +pub use super::refunds::Entity as Refunds; +pub use super::region_fulfillment_providers::Entity as RegionFulfillmentProviders; +pub use super::region_payment_providers::Entity as RegionPaymentProviders; +pub use super::regions::Entity as Regions; +pub use super::return_items::Entity as ReturnItems; +pub use super::return_reasons::Entity as ReturnReasons; +pub use super::returns::Entity as Returns; +pub use super::sales_channel_locations::Entity as SalesChannelLocations; +pub use super::sales_channels::Entity as SalesChannels; +pub use super::shipping_method_tax_lines::Entity as ShippingMethodTaxLines; +pub use super::shipping_methods::Entity as ShippingMethods; +pub use super::shipping_option_requirements::Entity as ShippingOptionRequirements; +pub use super::shipping_options::Entity as ShippingOptions; +pub use super::shipping_profiles::Entity as ShippingProfiles; +pub use super::shipping_tax_rates::Entity as ShippingTaxRates; +pub use super::staged_jobs::Entity as StagedJobs; +pub use super::store_currencies::Entity as StoreCurrencies; +pub use super::stores::Entity as Stores; +pub use super::swaps::Entity as Swaps; +pub use super::tax_providers::Entity as TaxProviders; +pub use super::tax_rates::Entity as TaxRates; +pub use super::tracking_links::Entity as TrackingLinks; +pub use super::users::Entity as Users; diff --git a/crates/model/src/v4/product_category_products.rs b/crates/model/src/v4/product_category_products.rs index 8399542..8b13789 100644 --- a/crates/model/src/v4/product_category_products.rs +++ b/crates/model/src/v4/product_category_products.rs @@ -1,29 +1 @@ -//! `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 { "product_category_products" } } - -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_category_id : String , pub product_id : String , } - -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductCategoryId , ProductId , } - -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { } - -impl PrimaryKeyTrait for PrimaryKey { type ValueType = ; fn auto_increment () -> bool { false } } - -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductCategories , Products , } - -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductCategoryId => ColumnType :: String (None) . def () , Self :: ProductId => ColumnType :: String (None) . def () , } } } - -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductCategories => Entity :: belongs_to (super :: product_categories :: Entity) . from (Column :: ProductCategoryId) . to (super :: product_categories :: Column :: Id) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } } - -impl Related < super :: product_categories :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductCategories . def () } } - -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file diff --git a/crates/model/src/v4/product_collections.rs b/crates/model/src/v4/product_collections.rs index f6a3e53..0ae83a0 100644 --- a/crates/model/src/v4/product_collections.rs +++ b/crates/model/src/v4/product_collections.rs @@ -1,29 +1,96 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_collections" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub title: String, + pub handle: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_collections" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Title, + Handle, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub title : String , pub handle : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Title , Handle , CreatedAt , UpdatedAt , DeletedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Products, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Title => ColumnType::String(None).def(), + Self::Handle => ColumnType::String(None).def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Products => Entity::has_many(super::products::Entity).into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Title => ColumnType :: String (None) . def () , Self :: Handle => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: has_many (super :: products :: Entity) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + super::discount_condition_product_collections::Relation::DiscountConditions.def() + } + fn via() -> Option { + Some( + super::discount_condition_product_collections::Relation::ProductCollections + .def() + .rev(), + ) + } +} -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl Related < super :: discount_conditions :: Entity > for Entity { fn to () -> RelationDef { super :: discount_condition_product_collections :: Relation :: DiscountConditions . def () } fn via () -> Option < RelationDef > { Some (super :: discount_condition_product_collections :: Relation :: ProductCollections . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_images.rs b/crates/model/src/v4/product_images.rs index 5a37b7a..edd00d6 100644 --- a/crates/model/src/v4/product_images.rs +++ b/crates/model/src/v4/product_images.rs @@ -1,29 +1,83 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_images" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub product_id: String, + pub image_id: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_images" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + ProductId, + ImageId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub image_id : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + ProductId, + ImageId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , ImageId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , ImageId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Images, + Products, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::ProductId => ColumnType::String(None).def(), + Self::ImageId => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Images , Products , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Images => Entity::belongs_to(super::images::Entity) + .from(Column::ImageId) + .to(super::images::Column::Id) + .into(), + Self::Products => Entity::belongs_to(super::products::Entity) + .from(Column::ProductId) + .to(super::products::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: ImageId => ColumnType :: String (None) . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Images.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Images => Entity :: belongs_to (super :: images :: Entity) . from (Column :: ImageId) . to (super :: images :: Column :: Id) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl Related < super :: images :: Entity > for Entity { fn to () -> RelationDef { Relation :: Images . def () } } - -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_option_values.rs b/crates/model/src/v4/product_option_values.rs index 84a6548..bfcc96d 100644 --- a/crates/model/src/v4/product_option_values.rs +++ b/crates/model/src/v4/product_option_values.rs @@ -1,29 +1,100 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_option_values" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub value: String, + pub option_id: String, + pub variant_id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_option_values" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Value, + OptionId, + VariantId, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub value : String , pub option_id : String , pub variant_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Value , OptionId , VariantId , CreatedAt , UpdatedAt , DeletedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ProductOptions, + ProductVariants, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Value => ColumnType::String(None).def(), + Self::OptionId => ColumnType::String(None).def(), + Self::VariantId => 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(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductOptions , ProductVariants , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ProductOptions => Entity::belongs_to(super::product_options::Entity) + .from(Column::OptionId) + .to(super::product_options::Column::Id) + .into(), + Self::ProductVariants => Entity::belongs_to(super::product_variants::Entity) + .from(Column::VariantId) + .to(super::product_variants::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Value => ColumnType :: String (None) . def () , Self :: OptionId => ColumnType :: String (None) . def () , Self :: VariantId => 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 Related for Entity { + fn to() -> RelationDef { + Relation::ProductOptions.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductOptions => Entity :: belongs_to (super :: product_options :: Entity) . from (Column :: OptionId) . to (super :: product_options :: Column :: Id) . into () , Self :: ProductVariants => Entity :: belongs_to (super :: product_variants :: Entity) . from (Column :: VariantId) . to (super :: product_variants :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductVariants.def() + } +} -impl Related < super :: product_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductOptions . def () } } - -impl Related < super :: product_variants :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductVariants . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_options.rs b/crates/model/src/v4/product_options.rs index e40c520..cc27944 100644 --- a/crates/model/src/v4/product_options.rs +++ b/crates/model/src/v4/product_options.rs @@ -1,29 +1,96 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_options" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub title: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub product_id: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_options" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Title, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + ProductId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub title : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub product_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Title , CreatedAt , UpdatedAt , DeletedAt , Metadata , ProductId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ProductOptionValues, + Products, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Title => 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(), + Self::ProductId => ColumnType::String(None).def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductOptionValues , Products , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ProductOptionValues => { + Entity::has_many(super::product_option_values::Entity).into() + } + Self::Products => Entity::belongs_to(super::products::Entity) + .from(Column::ProductId) + .to(super::products::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Title => 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 () , Self :: ProductId => ColumnType :: String (None) . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductOptionValues.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductOptionValues => Entity :: has_many (super :: product_option_values :: Entity) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl Related < super :: product_option_values :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductOptionValues . def () } } - -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_sales_channels.rs b/crates/model/src/v4/product_sales_channels.rs index 32ad014..00c73de 100644 --- a/crates/model/src/v4/product_sales_channels.rs +++ b/crates/model/src/v4/product_sales_channels.rs @@ -1,29 +1,83 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_sales_channels" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub product_id: String, + pub sales_channel_id: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_sales_channels" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + ProductId, + SalesChannelId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub sales_channel_id : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + ProductId, + SalesChannelId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , SalesChannelId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , SalesChannelId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Products, + SalesChannels, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::ProductId => ColumnType::String(None).def(), + Self::SalesChannelId => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , SalesChannels , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Products => Entity::belongs_to(super::products::Entity) + .from(Column::ProductId) + .to(super::products::Column::Id) + .into(), + Self::SalesChannels => Entity::belongs_to(super::sales_channels::Entity) + .from(Column::SalesChannelId) + .to(super::sales_channels::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: SalesChannelId => ColumnType :: String (None) . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , Self :: SalesChannels => Entity :: belongs_to (super :: sales_channels :: Entity) . from (Column :: SalesChannelId) . to (super :: sales_channels :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::SalesChannels.def() + } +} -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl Related < super :: sales_channels :: Entity > for Entity { fn to () -> RelationDef { Relation :: SalesChannels . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_tags.rs b/crates/model/src/v4/product_tags.rs index e29bf99..bda1a47 100644 --- a/crates/model/src/v4/product_tags.rs +++ b/crates/model/src/v4/product_tags.rs @@ -1,29 +1,92 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_tags" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub value: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_tags" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Value, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub value : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Value , CreatedAt , UpdatedAt , DeletedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Value => 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(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Value => 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 Related for Entity { + fn to() -> RelationDef { + super::discount_condition_product_tags::Relation::DiscountConditions.def() + } + fn via() -> Option { + Some( + super::discount_condition_product_tags::Relation::ProductTags + .def() + .rev(), + ) + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_to_tags::Relation::Products.def() + } + fn via() -> Option { + Some(super::product_to_tags::Relation::ProductTags.def().rev()) + } +} -impl Related < super :: discount_conditions :: Entity > for Entity { fn to () -> RelationDef { super :: discount_condition_product_tags :: Relation :: DiscountConditions . def () } fn via () -> Option < RelationDef > { Some (super :: discount_condition_product_tags :: Relation :: ProductTags . def () . rev ()) } } - -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { super :: product_to_tags :: Relation :: Products . def () } fn via () -> Option < RelationDef > { Some (super :: product_to_tags :: Relation :: ProductTags . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_tax_rates.rs b/crates/model/src/v4/product_tax_rates.rs index 159b046..c7ae7d6 100644 --- a/crates/model/src/v4/product_tax_rates.rs +++ b/crates/model/src/v4/product_tax_rates.rs @@ -1,29 +1,92 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_tax_rates" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub product_id: String, + pub rate_id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_tax_rates" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + ProductId, + RateId, + CreatedAt, + UpdatedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub rate_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + ProductId, + RateId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , RateId , CreatedAt , UpdatedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , RateId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Products, + TaxRates, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::ProductId => ColumnType::String(None).def(), + Self::RateId => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , TaxRates , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Products => Entity::belongs_to(super::products::Entity) + .from(Column::ProductId) + .to(super::products::Column::Id) + .into(), + Self::TaxRates => Entity::belongs_to(super::tax_rates::Entity) + .from(Column::RateId) + .to(super::tax_rates::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: RateId => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , Self :: TaxRates => Entity :: belongs_to (super :: tax_rates :: Entity) . from (Column :: RateId) . to (super :: tax_rates :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::TaxRates.def() + } +} -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { Relation :: TaxRates . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_to_tags.rs b/crates/model/src/v4/product_to_tags.rs index 62f7937..5ca59f3 100644 --- a/crates/model/src/v4/product_to_tags.rs +++ b/crates/model/src/v4/product_to_tags.rs @@ -1,29 +1,83 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_to_tags" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub product_id: String, + pub product_tag_id: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_to_tags" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + ProductId, + ProductTagId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub product_tag_id : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + ProductId, + ProductTagId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , ProductTagId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , ProductTagId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ProductTags, + Products, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::ProductId => ColumnType::String(None).def(), + Self::ProductTagId => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductTags , Products , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ProductTags => Entity::belongs_to(super::product_tags::Entity) + .from(Column::ProductTagId) + .to(super::product_tags::Column::Id) + .into(), + Self::Products => Entity::belongs_to(super::products::Entity) + .from(Column::ProductId) + .to(super::products::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: ProductTagId => ColumnType :: String (None) . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductTags.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductTags => Entity :: belongs_to (super :: product_tags :: Entity) . from (Column :: ProductTagId) . to (super :: product_tags :: Column :: Id) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl Related < super :: product_tags :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductTags . def () } } - -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_type_tax_rates.rs b/crates/model/src/v4/product_type_tax_rates.rs index e3c6503..cbedc4e 100644 --- a/crates/model/src/v4/product_type_tax_rates.rs +++ b/crates/model/src/v4/product_type_tax_rates.rs @@ -1,29 +1,92 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_type_tax_rates" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub product_type_id: String, + pub rate_id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_type_tax_rates" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + ProductTypeId, + RateId, + CreatedAt, + UpdatedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_type_id : String , pub rate_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + ProductTypeId, + RateId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductTypeId , RateId , CreatedAt , UpdatedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductTypeId , RateId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ProductTypes, + TaxRates, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::ProductTypeId => ColumnType::String(None).def(), + Self::RateId => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductTypes , TaxRates , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ProductTypes => Entity::belongs_to(super::product_types::Entity) + .from(Column::ProductTypeId) + .to(super::product_types::Column::Id) + .into(), + Self::TaxRates => Entity::belongs_to(super::tax_rates::Entity) + .from(Column::RateId) + .to(super::tax_rates::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductTypeId => ColumnType :: String (None) . def () , Self :: RateId => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductTypes.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductTypes => Entity :: belongs_to (super :: product_types :: Entity) . from (Column :: ProductTypeId) . to (super :: product_types :: Column :: Id) . into () , Self :: TaxRates => Entity :: belongs_to (super :: tax_rates :: Entity) . from (Column :: RateId) . to (super :: tax_rates :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::TaxRates.def() + } +} -impl Related < super :: product_types :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductTypes . def () } } - -impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { Relation :: TaxRates . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_types.rs b/crates/model/src/v4/product_types.rs index 6732327..88e4883 100644 --- a/crates/model/src/v4/product_types.rs +++ b/crates/model/src/v4/product_types.rs @@ -1,31 +1,106 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_types" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub value: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_types" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Value, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub value : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Value , CreatedAt , UpdatedAt , DeletedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Products, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Value => 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(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Products => Entity::has_many(super::products::Entity).into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Value => 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 Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: has_many (super :: products :: Entity) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_type_tax_rates::Relation::TaxRates.def() + } + fn via() -> Option { + Some( + super::product_type_tax_rates::Relation::ProductTypes + .def() + .rev(), + ) + } +} -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } +impl Related for Entity { + fn to() -> RelationDef { + super::discount_condition_product_types::Relation::DiscountConditions.def() + } + fn via() -> Option { + Some( + super::discount_condition_product_types::Relation::ProductTypes + .def() + .rev(), + ) + } +} -impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { super :: product_type_tax_rates :: Relation :: TaxRates . def () } fn via () -> Option < RelationDef > { Some (super :: product_type_tax_rates :: Relation :: ProductTypes . def () . rev ()) } } - -impl Related < super :: discount_conditions :: Entity > for Entity { fn to () -> RelationDef { super :: discount_condition_product_types :: Relation :: DiscountConditions . def () } fn via () -> Option < RelationDef > { Some (super :: discount_condition_product_types :: Relation :: ProductTypes . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_variant_inventory_items.rs b/crates/model/src/v4/product_variant_inventory_items.rs index 41f520f..8542f85 100644 --- a/crates/model/src/v4/product_variant_inventory_items.rs +++ b/crates/model/src/v4/product_variant_inventory_items.rs @@ -1,25 +1,73 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_variant_inventory_items" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub inventory_item_id: String, + pub variant_id: String, + pub required_quantity: i32, + pub deleted_at: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_variant_inventory_items" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + CreatedAt, + UpdatedAt, + InventoryItemId, + VariantId, + RequiredQuantity, + DeletedAt, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub inventory_item_id : String , pub variant_id : String , pub required_quantity : i32 , pub deleted_at : Option < DateTimeWithTimeZone > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , CreatedAt , UpdatedAt , InventoryItemId , VariantId , RequiredQuantity , DeletedAt , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::InventoryItemId => ColumnType::Text.def(), + Self::VariantId => ColumnType::Text.def(), + Self::RequiredQuantity => ColumnType::Integer.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: InventoryItemId => ColumnType :: Text . def () , Self :: VariantId => ColumnType :: Text . def () , Self :: RequiredQuantity => ColumnType :: Integer . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , } } } - -impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/product_variants.rs b/crates/model/src/v4/product_variants.rs index 535d562..d1d7dae 100644 --- a/crates/model/src/v4/product_variants.rs +++ b/crates/model/src/v4/product_variants.rs @@ -1,35 +1,168 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "product_variants" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub title: String, + pub product_id: String, + pub sku: Option, + pub barcode: Option, + pub ean: Option, + pub upc: Option, + pub inventory_quantity: i32, + pub allow_backorder: bool, + pub manage_inventory: bool, + pub hs_code: Option, + pub origin_country: Option, + pub mid_code: Option, + pub material: Option, + pub weight: Option, + pub length: Option, + pub height: Option, + pub width: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub variant_rank: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "product_variants" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Title, + ProductId, + Sku, + Barcode, + Ean, + Upc, + InventoryQuantity, + AllowBackorder, + ManageInventory, + HsCode, + OriginCountry, + MidCode, + Material, + Weight, + Length, + Height, + Width, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + VariantRank, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub title : String , pub product_id : String , pub sku : Option < String > , pub barcode : Option < String > , pub ean : Option < String > , pub upc : Option < String > , pub inventory_quantity : i32 , pub allow_backorder : bool , pub manage_inventory : bool , pub hs_code : Option < String > , pub origin_country : Option < String > , pub mid_code : Option < String > , pub material : Option < String > , pub weight : Option < i32 > , pub length : Option < i32 > , pub height : Option < i32 > , pub width : Option < i32 > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub variant_rank : Option < i32 > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Title , ProductId , Sku , Barcode , Ean , Upc , InventoryQuantity , AllowBackorder , ManageInventory , HsCode , OriginCountry , MidCode , Material , Weight , Length , Height , Width , CreatedAt , UpdatedAt , DeletedAt , Metadata , VariantRank , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ClaimItems, + LineItems, + MoneyAmounts, + ProductOptionValues, + Products, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Title => ColumnType::String(None).def(), + Self::ProductId => ColumnType::String(None).def(), + Self::Sku => ColumnType::String(None).def().null(), + Self::Barcode => ColumnType::String(None).def().null(), + Self::Ean => ColumnType::String(None).def().null(), + Self::Upc => ColumnType::String(None).def().null(), + Self::InventoryQuantity => ColumnType::Integer.def(), + Self::AllowBackorder => ColumnType::Boolean.def(), + Self::ManageInventory => ColumnType::Boolean.def(), + Self::HsCode => ColumnType::String(None).def().null(), + Self::OriginCountry => ColumnType::String(None).def().null(), + Self::MidCode => ColumnType::String(None).def().null(), + Self::Material => ColumnType::String(None).def().null(), + Self::Weight => ColumnType::Integer.def().null(), + Self::Length => ColumnType::Integer.def().null(), + Self::Height => ColumnType::Integer.def().null(), + Self::Width => ColumnType::Integer.def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::VariantRank => ColumnType::Integer.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ClaimItems , LineItems , MoneyAmounts , ProductOptionValues , Products , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ClaimItems => Entity::has_many(super::claim_items::Entity).into(), + Self::LineItems => Entity::has_many(super::line_items::Entity).into(), + Self::MoneyAmounts => Entity::has_many(super::money_amounts::Entity).into(), + Self::ProductOptionValues => { + Entity::has_many(super::product_option_values::Entity).into() + } + Self::Products => Entity::belongs_to(super::products::Entity) + .from(Column::ProductId) + .to(super::products::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Title => ColumnType :: String (None) . def () , Self :: ProductId => ColumnType :: String (None) . def () , Self :: Sku => ColumnType :: String (None) . def () . null () , Self :: Barcode => ColumnType :: String (None) . def () . null () , Self :: Ean => ColumnType :: String (None) . def () . null () , Self :: Upc => ColumnType :: String (None) . def () . null () , Self :: InventoryQuantity => ColumnType :: Integer . def () , Self :: AllowBackorder => ColumnType :: Boolean . def () , Self :: ManageInventory => ColumnType :: Boolean . def () , Self :: HsCode => ColumnType :: String (None) . def () . null () , Self :: OriginCountry => ColumnType :: String (None) . def () . null () , Self :: MidCode => ColumnType :: String (None) . def () . null () , Self :: Material => ColumnType :: String (None) . def () . null () , Self :: Weight => ColumnType :: Integer . def () . null () , Self :: Length => ColumnType :: Integer . def () . null () , Self :: Height => ColumnType :: Integer . def () . null () , Self :: Width => ColumnType :: Integer . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: VariantRank => ColumnType :: Integer . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ClaimItems.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ClaimItems => Entity :: has_many (super :: claim_items :: Entity) . into () , Self :: LineItems => Entity :: has_many (super :: line_items :: Entity) . into () , Self :: MoneyAmounts => Entity :: has_many (super :: money_amounts :: Entity) . into () , Self :: ProductOptionValues => Entity :: has_many (super :: product_option_values :: Entity) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::LineItems.def() + } +} -impl Related < super :: claim_items :: Entity > for Entity { fn to () -> RelationDef { Relation :: ClaimItems . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::MoneyAmounts.def() + } +} -impl Related < super :: line_items :: Entity > for Entity { fn to () -> RelationDef { Relation :: LineItems . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductOptionValues.def() + } +} -impl Related < super :: money_amounts :: Entity > for Entity { fn to () -> RelationDef { Relation :: MoneyAmounts . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl Related < super :: product_option_values :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductOptionValues . def () } } - -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/products.rs b/crates/model/src/v4/products.rs index 0eb3eab..7015572 100644 --- a/crates/model/src/v4/products.rs +++ b/crates/model/src/v4/products.rs @@ -1,49 +1,256 @@ //! `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::ProductStatuses; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: ProductStatuses ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "products" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "products" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub title: String, + pub subtitle: Option, + pub description: Option, + pub handle: Option, + pub is_giftcard: bool, + pub thumbnail: Option, + pub profile_id: String, + pub weight: Option, + pub length: Option, + pub height: Option, + pub width: Option, + pub hs_code: Option, + pub origin_country: Option, + pub mid_code: Option, + pub material: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub collection_id: Option, + pub type_id: Option, + pub discountable: bool, + pub status: ProductStatuses, + pub external_id: Option, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub title : String , pub subtitle : Option < String > , pub description : Option < String > , pub handle : Option < String > , pub is_giftcard : bool , pub thumbnail : Option < String > , pub profile_id : String , pub weight : Option < i32 > , pub length : Option < i32 > , pub height : Option < i32 > , pub width : Option < i32 > , pub hs_code : Option < String > , pub origin_country : Option < String > , pub mid_code : Option < String > , pub material : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub collection_id : Option < String > , pub type_id : Option < String > , pub discountable : bool , pub status : ProductStatuses , pub external_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Title, + Subtitle, + Description, + Handle, + IsGiftcard, + Thumbnail, + ProfileId, + Weight, + Length, + Height, + Width, + HsCode, + OriginCountry, + MidCode, + Material, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + CollectionId, + TypeId, + Discountable, + Status, + ExternalId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Title , Subtitle , Description , Handle , IsGiftcard , Thumbnail , ProfileId , Weight , Length , Height , Width , HsCode , OriginCountry , MidCode , Material , CreatedAt , UpdatedAt , DeletedAt , Metadata , CollectionId , TypeId , Discountable , Status , ExternalId , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ProductCategoryProducts, + ProductCollections, + ProductOptions, + ProductTypes, + ProductVariants, + ShippingProfiles, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductCategoryProducts , ProductCollections , ProductOptions , ProductTypes , ProductVariants , ShippingProfiles , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Title => ColumnType::String(None).def(), + Self::Subtitle => ColumnType::String(None).def().null(), + Self::Description => ColumnType::String(None).def().null(), + Self::Handle => ColumnType::String(None).def().null(), + Self::IsGiftcard => ColumnType::Boolean.def(), + Self::Thumbnail => ColumnType::String(None).def().null(), + Self::ProfileId => ColumnType::String(None).def(), + Self::Weight => ColumnType::Integer.def().null(), + Self::Length => ColumnType::Integer.def().null(), + Self::Height => ColumnType::Integer.def().null(), + Self::Width => ColumnType::Integer.def().null(), + Self::HsCode => ColumnType::String(None).def().null(), + Self::OriginCountry => ColumnType::String(None).def().null(), + Self::MidCode => ColumnType::String(None).def().null(), + Self::Material => ColumnType::String(None).def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::CollectionId => ColumnType::String(None).def().null(), + Self::TypeId => ColumnType::String(None).def().null(), + Self::Discountable => ColumnType::Boolean.def(), + Self::Status => ProductStatuses::db_type().def(), + Self::ExternalId => ColumnType::String(None).def().null(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Title => ColumnType :: String (None) . def () , Self :: Subtitle => ColumnType :: String (None) . def () . null () , Self :: Description => ColumnType :: String (None) . def () . null () , Self :: Handle => ColumnType :: String (None) . def () . null () , Self :: IsGiftcard => ColumnType :: Boolean . def () , Self :: Thumbnail => ColumnType :: String (None) . def () . null () , Self :: ProfileId => ColumnType :: String (None) . def () , Self :: Weight => ColumnType :: Integer . def () . null () , Self :: Length => ColumnType :: Integer . def () . null () , Self :: Height => ColumnType :: Integer . def () . null () , Self :: Width => ColumnType :: Integer . def () . null () , Self :: HsCode => ColumnType :: String (None) . def () . null () , Self :: OriginCountry => ColumnType :: String (None) . def () . null () , Self :: MidCode => ColumnType :: String (None) . def () . null () , Self :: Material => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: CollectionId => ColumnType :: String (None) . def () . null () , Self :: TypeId => ColumnType :: String (None) . def () . null () , Self :: Discountable => ColumnType :: Boolean . def () , Self :: Status => ProductStatuses :: db_type () . def () , Self :: ExternalId => ColumnType :: String (None) . def () . null () , } } } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ProductCategoryProducts => { + Entity::has_many(super::product_category_products::Entity).into() + } + Self::ProductCollections => Entity::belongs_to(super::product_collections::Entity) + .from(Column::CollectionId) + .to(super::product_collections::Column::Id) + .into(), + Self::ProductOptions => Entity::has_many(super::product_options::Entity).into(), + Self::ProductTypes => Entity::belongs_to(super::product_types::Entity) + .from(Column::TypeId) + .to(super::product_types::Column::Id) + .into(), + Self::ProductVariants => Entity::has_many(super::product_variants::Entity).into(), + Self::ShippingProfiles => Entity::belongs_to(super::shipping_profiles::Entity) + .from(Column::ProfileId) + .to(super::shipping_profiles::Column::Id) + .into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductCategoryProducts => Entity :: has_many (super :: product_category_products :: Entity) . into () , Self :: ProductCollections => Entity :: belongs_to (super :: product_collections :: Entity) . from (Column :: CollectionId) . to (super :: product_collections :: Column :: Id) . into () , Self :: ProductOptions => Entity :: has_many (super :: product_options :: Entity) . into () , Self :: ProductTypes => Entity :: belongs_to (super :: product_types :: Entity) . from (Column :: TypeId) . to (super :: product_types :: Column :: Id) . into () , Self :: ProductVariants => Entity :: has_many (super :: product_variants :: Entity) . into () , Self :: ShippingProfiles => Entity :: belongs_to (super :: shipping_profiles :: Entity) . from (Column :: ProfileId) . to (super :: shipping_profiles :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductCategoryProducts.def() + } +} -impl Related < super :: product_category_products :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductCategoryProducts . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductCollections.def() + } +} -impl Related < super :: product_collections :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductCollections . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductOptions.def() + } +} -impl Related < super :: product_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductOptions . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductTypes.def() + } +} -impl Related < super :: product_types :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductTypes . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ProductVariants.def() + } +} -impl Related < super :: product_variants :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductVariants . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingProfiles.def() + } +} -impl Related < super :: shipping_profiles :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingProfiles . def () } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_tax_rates::Relation::TaxRates.def() + } + fn via() -> Option { + Some(super::product_tax_rates::Relation::Products.def().rev()) + } +} -impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { super :: product_tax_rates :: Relation :: TaxRates . def () } fn via () -> Option < RelationDef > { Some (super :: product_tax_rates :: Relation :: Products . def () . rev ()) } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_to_tags::Relation::ProductTags.def() + } + fn via() -> Option { + Some(super::product_to_tags::Relation::Products.def().rev()) + } +} -impl Related < super :: product_tags :: Entity > for Entity { fn to () -> RelationDef { super :: product_to_tags :: Relation :: ProductTags . def () } fn via () -> Option < RelationDef > { Some (super :: product_to_tags :: Relation :: Products . def () . rev ()) } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_images::Relation::Images.def() + } + fn via() -> Option { + Some(super::product_images::Relation::Products.def().rev()) + } +} -impl Related < super :: images :: Entity > for Entity { fn to () -> RelationDef { super :: product_images :: Relation :: Images . def () } fn via () -> Option < RelationDef > { Some (super :: product_images :: Relation :: Products . def () . rev ()) } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_sales_channels::Relation::SalesChannels.def() + } + fn via() -> Option { + Some( + super::product_sales_channels::Relation::Products + .def() + .rev(), + ) + } +} -impl Related < super :: sales_channels :: Entity > for Entity { fn to () -> RelationDef { super :: product_sales_channels :: Relation :: SalesChannels . def () } fn via () -> Option < RelationDef > { Some (super :: product_sales_channels :: Relation :: Products . def () . rev ()) } } +impl Related for Entity { + fn to() -> RelationDef { + super::discount_rule_products::Relation::DiscountRules.def() + } + fn via() -> Option { + Some( + super::discount_rule_products::Relation::Products + .def() + .rev(), + ) + } +} -impl Related < super :: discount_rules :: Entity > for Entity { fn to () -> RelationDef { super :: discount_rule_products :: Relation :: DiscountRules . def () } fn via () -> Option < RelationDef > { Some (super :: discount_rule_products :: Relation :: Products . def () . rev ()) } } +impl Related for Entity { + fn to() -> RelationDef { + super::discount_condition_products::Relation::DiscountConditions.def() + } + fn via() -> Option { + Some( + super::discount_condition_products::Relation::Products + .def() + .rev(), + ) + } +} -impl Related < super :: discount_conditions :: Entity > for Entity { fn to () -> RelationDef { super :: discount_condition_products :: Relation :: DiscountConditions . def () } fn via () -> Option < RelationDef > { Some (super :: discount_condition_products :: Relation :: Products . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/publishable_api_key_sales_channels.rs b/crates/model/src/v4/publishable_api_key_sales_channels.rs index c6a417c..15d7b25 100644 --- a/crates/model/src/v4/publishable_api_key_sales_channels.rs +++ b/crates/model/src/v4/publishable_api_key_sales_channels.rs @@ -1,25 +1,59 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "publishable_api_key_sales_channels" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub sales_channel_id: String, + pub publishable_key_id: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "publishable_api_key_sales_channels" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + SalesChannelId, + PublishableKeyId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub sales_channel_id : String , pub publishable_key_id : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + SalesChannelId, + PublishableKeyId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { SalesChannelId , PublishableKeyId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { SalesChannelId , PublishableKeyId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::SalesChannelId => ColumnType::String(None).def(), + Self::PublishableKeyId => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: SalesChannelId => ColumnType :: String (None) . def () , Self :: PublishableKeyId => ColumnType :: String (None) . def () , } } } - -impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/publishable_api_keys.rs b/crates/model/src/v4/publishable_api_keys.rs index 83109ba..c6c70a6 100644 --- a/crates/model/src/v4/publishable_api_keys.rs +++ b/crates/model/src/v4/publishable_api_keys.rs @@ -1,25 +1,73 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "publishable_api_keys" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub created_by: Option, + pub revoked_by: Option, + pub revoked_at: Option, + pub title: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "publishable_api_keys" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + CreatedAt, + UpdatedAt, + CreatedBy, + RevokedBy, + RevokedAt, + Title, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub created_by : Option < String > , pub revoked_by : Option < String > , pub revoked_at : Option < DateTimeWithTimeZone > , pub title : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , CreatedAt , UpdatedAt , CreatedBy , RevokedBy , RevokedAt , Title , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::CreatedBy => ColumnType::String(None).def().null(), + Self::RevokedBy => ColumnType::String(None).def().null(), + Self::RevokedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Title => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: CreatedBy => ColumnType :: String (None) . def () . null () , Self :: RevokedBy => ColumnType :: String (None) . def () . null () , Self :: RevokedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Title => ColumnType :: String (None) . def () , } } } - -impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/refunds.rs b/crates/model/src/v4/refunds.rs index 31c5c2d..978459f 100644 --- a/crates/model/src/v4/refunds.rs +++ b/crates/model/src/v4/refunds.rs @@ -1,29 +1,108 @@ //! `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::RefundReasons; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: RefundReasons ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "refunds" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "refunds" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub order_id: Option, + pub amount: i32, + pub note: Option, + pub reason: RefundReasons, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, + pub idempotency_key: Option, + pub payment_id: Option, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub order_id : Option < String > , pub amount : i32 , pub note : Option < String > , pub reason : RefundReasons , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , pub idempotency_key : Option < String > , pub payment_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + OrderId, + Amount, + Note, + Reason, + CreatedAt, + UpdatedAt, + Metadata, + IdempotencyKey, + PaymentId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , OrderId , Amount , Note , Reason , CreatedAt , UpdatedAt , Metadata , IdempotencyKey , PaymentId , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Orders, + Payments, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Orders , Payments , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::OrderId => ColumnType::String(None).def().null(), + Self::Amount => ColumnType::Integer.def(), + Self::Note => ColumnType::String(None).def().null(), + Self::Reason => RefundReasons::db_type().def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::IdempotencyKey => ColumnType::String(None).def().null(), + Self::PaymentId => ColumnType::String(None).def().null(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: OrderId => ColumnType :: String (None) . def () . null () , Self :: Amount => ColumnType :: Integer . def () , Self :: Note => ColumnType :: String (None) . def () . null () , Self :: Reason => RefundReasons :: db_type () . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: IdempotencyKey => ColumnType :: String (None) . def () . null () , Self :: PaymentId => ColumnType :: String (None) . def () . null () , } } } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Orders => Entity::belongs_to(super::orders::Entity) + .from(Column::OrderId) + .to(super::orders::Column::Id) + .into(), + Self::Payments => Entity::belongs_to(super::payments::Entity) + .from(Column::PaymentId) + .to(super::payments::Column::Id) + .into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Orders => Entity :: belongs_to (super :: orders :: Entity) . from (Column :: OrderId) . to (super :: orders :: Column :: Id) . into () , Self :: Payments => Entity :: belongs_to (super :: payments :: Entity) . from (Column :: PaymentId) . to (super :: payments :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Orders.def() + } +} -impl Related < super :: orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: Orders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Payments.def() + } +} -impl Related < super :: payments :: Entity > for Entity { fn to () -> RelationDef { Relation :: Payments . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/region_fulfillment_providers.rs b/crates/model/src/v4/region_fulfillment_providers.rs index 1d0ab46..19f8799 100644 --- a/crates/model/src/v4/region_fulfillment_providers.rs +++ b/crates/model/src/v4/region_fulfillment_providers.rs @@ -1,29 +1,83 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "region_fulfillment_providers" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub region_id: String, + pub provider_id: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "region_fulfillment_providers" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + RegionId, + ProviderId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub region_id : String , pub provider_id : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + RegionId, + ProviderId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { RegionId , ProviderId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { RegionId , ProviderId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + FulfillmentProviders, + Regions, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::RegionId => ColumnType::String(None).def(), + Self::ProviderId => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { FulfillmentProviders , Regions , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::FulfillmentProviders => Entity::belongs_to(super::fulfillment_providers::Entity) + .from(Column::ProviderId) + .to(super::fulfillment_providers::Column::Id) + .into(), + Self::Regions => Entity::belongs_to(super::regions::Entity) + .from(Column::RegionId) + .to(super::regions::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: RegionId => ColumnType :: String (None) . def () , Self :: ProviderId => ColumnType :: String (None) . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::FulfillmentProviders.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: FulfillmentProviders => Entity :: belongs_to (super :: fulfillment_providers :: Entity) . from (Column :: ProviderId) . to (super :: fulfillment_providers :: Column :: Id) . into () , Self :: Regions => Entity :: belongs_to (super :: regions :: Entity) . from (Column :: RegionId) . to (super :: regions :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Regions.def() + } +} -impl Related < super :: fulfillment_providers :: Entity > for Entity { fn to () -> RelationDef { Relation :: FulfillmentProviders . def () } } - -impl Related < super :: regions :: Entity > for Entity { fn to () -> RelationDef { Relation :: Regions . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/region_payment_providers.rs b/crates/model/src/v4/region_payment_providers.rs index 2bbb851..33b2419 100644 --- a/crates/model/src/v4/region_payment_providers.rs +++ b/crates/model/src/v4/region_payment_providers.rs @@ -1,29 +1,83 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "region_payment_providers" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub region_id: String, + pub provider_id: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "region_payment_providers" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + RegionId, + ProviderId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub region_id : String , pub provider_id : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + RegionId, + ProviderId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { RegionId , ProviderId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { RegionId , ProviderId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + PaymentProviders, + Regions, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::RegionId => ColumnType::String(None).def(), + Self::ProviderId => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { PaymentProviders , Regions , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::PaymentProviders => Entity::belongs_to(super::payment_providers::Entity) + .from(Column::ProviderId) + .to(super::payment_providers::Column::Id) + .into(), + Self::Regions => Entity::belongs_to(super::regions::Entity) + .from(Column::RegionId) + .to(super::regions::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: RegionId => ColumnType :: String (None) . def () , Self :: ProviderId => ColumnType :: String (None) . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::PaymentProviders.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: PaymentProviders => Entity :: belongs_to (super :: payment_providers :: Entity) . from (Column :: ProviderId) . to (super :: payment_providers :: Column :: Id) . into () , Self :: Regions => Entity :: belongs_to (super :: regions :: Entity) . from (Column :: RegionId) . to (super :: regions :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Regions.def() + } +} -impl Related < super :: payment_providers :: Entity > for Entity { fn to () -> RelationDef { Relation :: PaymentProviders . def () } } - -impl Related < super :: regions :: Entity > for Entity { fn to () -> RelationDef { Relation :: Regions . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/regions.rs b/crates/model/src/v4/regions.rs index 7b850b7..dc93258 100644 --- a/crates/model/src/v4/regions.rs +++ b/crates/model/src/v4/regions.rs @@ -1,51 +1,211 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "regions" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub name: String, + pub currency_code: String, + pub tax_rate: f32, + pub tax_code: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub gift_cards_taxable: bool, + pub automatic_taxes: bool, + pub tax_provider_id: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "regions" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Name, + CurrencyCode, + TaxRate, + TaxCode, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + GiftCardsTaxable, + AutomaticTaxes, + TaxProviderId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Serialize , Deserialize)] pub struct Model { pub id : String , pub name : String , pub currency_code : String , pub tax_rate : f32 , pub tax_code : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub gift_cards_taxable : bool , pub automatic_taxes : bool , pub tax_provider_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Name , CurrencyCode , TaxRate , TaxCode , CreatedAt , UpdatedAt , DeletedAt , Metadata , GiftCardsTaxable , AutomaticTaxes , TaxProviderId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Carts, + Countries, + Currencies, + GiftCards, + MoneyAmounts, + Orders, + PaymentCollections, + ShippingOptions, + TaxProviders, + TaxRates, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Name => ColumnType::String(None).def(), + Self::CurrencyCode => ColumnType::String(None).def(), + Self::TaxRate => ColumnType::Float.def(), + Self::TaxCode => ColumnType::String(None).def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::GiftCardsTaxable => ColumnType::Boolean.def(), + Self::AutomaticTaxes => ColumnType::Boolean.def(), + Self::TaxProviderId => ColumnType::String(None).def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Carts , Countries , Currencies , GiftCards , MoneyAmounts , Orders , PaymentCollections , ShippingOptions , TaxProviders , TaxRates , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Carts => Entity::has_many(super::carts::Entity).into(), + Self::Countries => Entity::has_many(super::countries::Entity).into(), + Self::Currencies => Entity::belongs_to(super::currencies::Entity) + .from(Column::CurrencyCode) + .to(super::currencies::Column::Code) + .into(), + Self::GiftCards => Entity::has_many(super::gift_cards::Entity).into(), + Self::MoneyAmounts => Entity::has_many(super::money_amounts::Entity).into(), + Self::Orders => Entity::has_many(super::orders::Entity).into(), + Self::PaymentCollections => Entity::has_many(super::payment_collections::Entity).into(), + Self::ShippingOptions => Entity::has_many(super::shipping_options::Entity).into(), + Self::TaxProviders => Entity::belongs_to(super::tax_providers::Entity) + .from(Column::TaxProviderId) + .to(super::tax_providers::Column::Id) + .into(), + Self::TaxRates => Entity::has_many(super::tax_rates::Entity).into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Name => ColumnType :: String (None) . def () , Self :: CurrencyCode => ColumnType :: String (None) . def () , Self :: TaxRate => ColumnType :: Float . def () , Self :: TaxCode => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: GiftCardsTaxable => ColumnType :: Boolean . def () , Self :: AutomaticTaxes => ColumnType :: Boolean . def () , Self :: TaxProviderId => ColumnType :: String (None) . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Carts.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Carts => Entity :: has_many (super :: carts :: Entity) . into () , Self :: Countries => Entity :: has_many (super :: countries :: Entity) . into () , Self :: Currencies => Entity :: belongs_to (super :: currencies :: Entity) . from (Column :: CurrencyCode) . to (super :: currencies :: Column :: Code) . into () , Self :: GiftCards => Entity :: has_many (super :: gift_cards :: Entity) . into () , Self :: MoneyAmounts => Entity :: has_many (super :: money_amounts :: Entity) . into () , Self :: Orders => Entity :: has_many (super :: orders :: Entity) . into () , Self :: PaymentCollections => Entity :: has_many (super :: payment_collections :: Entity) . into () , Self :: ShippingOptions => Entity :: has_many (super :: shipping_options :: Entity) . into () , Self :: TaxProviders => Entity :: belongs_to (super :: tax_providers :: Entity) . from (Column :: TaxProviderId) . to (super :: tax_providers :: Column :: Id) . into () , Self :: TaxRates => Entity :: has_many (super :: tax_rates :: Entity) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Countries.def() + } +} -impl Related < super :: carts :: Entity > for Entity { fn to () -> RelationDef { Relation :: Carts . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Currencies.def() + } +} -impl Related < super :: countries :: Entity > for Entity { fn to () -> RelationDef { Relation :: Countries . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::GiftCards.def() + } +} -impl Related < super :: currencies :: Entity > for Entity { fn to () -> RelationDef { Relation :: Currencies . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::MoneyAmounts.def() + } +} -impl Related < super :: gift_cards :: Entity > for Entity { fn to () -> RelationDef { Relation :: GiftCards . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Orders.def() + } +} -impl Related < super :: money_amounts :: Entity > for Entity { fn to () -> RelationDef { Relation :: MoneyAmounts . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::PaymentCollections.def() + } +} -impl Related < super :: orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: Orders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingOptions.def() + } +} -impl Related < super :: payment_collections :: Entity > for Entity { fn to () -> RelationDef { Relation :: PaymentCollections . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::TaxProviders.def() + } +} -impl Related < super :: shipping_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingOptions . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::TaxRates.def() + } +} -impl Related < super :: tax_providers :: Entity > for Entity { fn to () -> RelationDef { Relation :: TaxProviders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + super::region_fulfillment_providers::Relation::FulfillmentProviders.def() + } + fn via() -> Option { + Some( + super::region_fulfillment_providers::Relation::Regions + .def() + .rev(), + ) + } +} -impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { Relation :: TaxRates . def () } } +impl Related for Entity { + fn to() -> RelationDef { + super::region_payment_providers::Relation::PaymentProviders.def() + } + fn via() -> Option { + Some( + super::region_payment_providers::Relation::Regions + .def() + .rev(), + ) + } +} -impl Related < super :: fulfillment_providers :: Entity > for Entity { fn to () -> RelationDef { super :: region_fulfillment_providers :: Relation :: FulfillmentProviders . def () } fn via () -> Option < RelationDef > { Some (super :: region_fulfillment_providers :: Relation :: Regions . def () . rev ()) } } +impl Related for Entity { + fn to() -> RelationDef { + super::discount_regions::Relation::Discounts.def() + } + fn via() -> Option { + Some(super::discount_regions::Relation::Regions.def().rev()) + } +} -impl Related < super :: payment_providers :: Entity > for Entity { fn to () -> RelationDef { super :: region_payment_providers :: Relation :: PaymentProviders . def () } fn via () -> Option < RelationDef > { Some (super :: region_payment_providers :: Relation :: Regions . def () . rev ()) } } - -impl Related < super :: discounts :: Entity > for Entity { fn to () -> RelationDef { super :: discount_regions :: Relation :: Discounts . def () } fn via () -> Option < RelationDef > { Some (super :: discount_regions :: Relation :: Regions . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/return_items.rs b/crates/model/src/v4/return_items.rs index 2265305..79b3b2b 100644 --- a/crates/model/src/v4/return_items.rs +++ b/crates/model/src/v4/return_items.rs @@ -1,31 +1,115 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "return_items" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub return_id: String, + pub item_id: String, + pub quantity: i32, + pub is_requested: bool, + pub requested_quantity: Option, + pub received_quantity: Option, + pub metadata: Option, + pub reason_id: Option, + pub note: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "return_items" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + ReturnId, + ItemId, + Quantity, + IsRequested, + RequestedQuantity, + ReceivedQuantity, + Metadata, + ReasonId, + Note, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub return_id : String , pub item_id : String , pub quantity : i32 , pub is_requested : bool , pub requested_quantity : Option < i32 > , pub received_quantity : Option < i32 > , pub metadata : Option < Json > , pub reason_id : Option < String > , pub note : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + ReturnId, + ItemId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ReturnId , ItemId , Quantity , IsRequested , RequestedQuantity , ReceivedQuantity , Metadata , ReasonId , Note , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ReturnId , ItemId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + LineItems, + ReturnReasons, + Returns, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::ReturnId => ColumnType::String(None).def(), + Self::ItemId => ColumnType::String(None).def(), + Self::Quantity => ColumnType::Integer.def(), + Self::IsRequested => ColumnType::Boolean.def(), + Self::RequestedQuantity => ColumnType::Integer.def().null(), + Self::ReceivedQuantity => ColumnType::Integer.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::ReasonId => ColumnType::String(None).def().null(), + Self::Note => ColumnType::String(None).def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { LineItems , ReturnReasons , Returns , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::LineItems => Entity::belongs_to(super::line_items::Entity) + .from(Column::ItemId) + .to(super::line_items::Column::Id) + .into(), + Self::ReturnReasons => Entity::belongs_to(super::return_reasons::Entity) + .from(Column::ReasonId) + .to(super::return_reasons::Column::Id) + .into(), + Self::Returns => Entity::belongs_to(super::returns::Entity) + .from(Column::ReturnId) + .to(super::returns::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ReturnId => ColumnType :: String (None) . def () , Self :: ItemId => ColumnType :: String (None) . def () , Self :: Quantity => ColumnType :: Integer . def () , Self :: IsRequested => ColumnType :: Boolean . def () , Self :: RequestedQuantity => ColumnType :: Integer . def () . null () , Self :: ReceivedQuantity => ColumnType :: Integer . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: ReasonId => ColumnType :: String (None) . def () . null () , Self :: Note => ColumnType :: String (None) . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::LineItems.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: LineItems => Entity :: belongs_to (super :: line_items :: Entity) . from (Column :: ItemId) . to (super :: line_items :: Column :: Id) . into () , Self :: ReturnReasons => Entity :: belongs_to (super :: return_reasons :: Entity) . from (Column :: ReasonId) . to (super :: return_reasons :: Column :: Id) . into () , Self :: Returns => Entity :: belongs_to (super :: returns :: Entity) . from (Column :: ReturnId) . to (super :: returns :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ReturnReasons.def() + } +} -impl Related < super :: line_items :: Entity > for Entity { fn to () -> RelationDef { Relation :: LineItems . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Returns.def() + } +} -impl Related < super :: return_reasons :: Entity > for Entity { fn to () -> RelationDef { Relation :: ReturnReasons . def () } } - -impl Related < super :: returns :: Entity > for Entity { fn to () -> RelationDef { Relation :: Returns . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/return_reasons.rs b/crates/model/src/v4/return_reasons.rs index 261d73c..6b1fc77 100644 --- a/crates/model/src/v4/return_reasons.rs +++ b/crates/model/src/v4/return_reasons.rs @@ -1,27 +1,94 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "return_reasons" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub value: String, + pub label: String, + pub description: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub parent_return_reason_id: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "return_reasons" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Value, + Label, + Description, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + ParentReturnReasonId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub value : String , pub label : String , pub description : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub parent_return_reason_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Value , Label , Description , CreatedAt , UpdatedAt , DeletedAt , Metadata , ParentReturnReasonId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ReturnItems, + SelfRef, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Value => ColumnType::String(None).def(), + Self::Label => ColumnType::String(None).def(), + Self::Description => ColumnType::String(None).def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::ParentReturnReasonId => ColumnType::String(None).def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ReturnItems , SelfRef , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ReturnItems => Entity::has_many(super::return_items::Entity).into(), + Self::SelfRef => Entity::belongs_to(Entity) + .from(Column::ParentReturnReasonId) + .to(Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Value => ColumnType :: String (None) . def () , Self :: Label => ColumnType :: String (None) . def () , Self :: Description => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: ParentReturnReasonId => ColumnType :: String (None) . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ReturnItems.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ReturnItems => Entity :: has_many (super :: return_items :: Entity) . into () , Self :: SelfRef => Entity :: belongs_to (Entity) . from (Column :: ParentReturnReasonId) . to (Column :: Id) . into () , } } } - -impl Related < super :: return_items :: Entity > for Entity { fn to () -> RelationDef { Relation :: ReturnItems . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/returns.rs b/crates/model/src/v4/returns.rs index 61fcaef..b7a2ae9 100644 --- a/crates/model/src/v4/returns.rs +++ b/crates/model/src/v4/returns.rs @@ -1,35 +1,147 @@ //! `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::ReturnStatuses; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: ReturnStatuses ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "returns" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "returns" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub status: ReturnStatuses, + pub swap_id: Option, + pub order_id: Option, + pub shipping_data: Option, + pub refund_amount: i32, + pub received_at: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, + pub idempotency_key: Option, + pub claim_order_id: Option, + pub no_notification: Option, + pub location_id: Option, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub status : ReturnStatuses , pub swap_id : Option < String > , pub order_id : Option < String > , pub shipping_data : Option < Json > , pub refund_amount : i32 , pub received_at : Option < DateTimeWithTimeZone > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , pub idempotency_key : Option < String > , pub claim_order_id : Option < String > , pub no_notification : Option < bool > , pub location_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Status, + SwapId, + OrderId, + ShippingData, + RefundAmount, + ReceivedAt, + CreatedAt, + UpdatedAt, + Metadata, + IdempotencyKey, + ClaimOrderId, + NoNotification, + LocationId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Status , SwapId , OrderId , ShippingData , RefundAmount , ReceivedAt , CreatedAt , UpdatedAt , Metadata , IdempotencyKey , ClaimOrderId , NoNotification , LocationId , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ClaimOrders, + Orders, + ReturnItems, + ShippingMethods, + Swaps, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ClaimOrders , Orders , ReturnItems , ShippingMethods , Swaps , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Status => ReturnStatuses::db_type().def(), + Self::SwapId => ColumnType::String(None).def().null().unique(), + Self::OrderId => ColumnType::String(None).def().null(), + Self::ShippingData => ColumnType::JsonBinary.def().null(), + Self::RefundAmount => ColumnType::Integer.def(), + Self::ReceivedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::IdempotencyKey => ColumnType::String(None).def().null(), + Self::ClaimOrderId => ColumnType::String(None).def().null().unique(), + Self::NoNotification => ColumnType::Boolean.def().null(), + Self::LocationId => ColumnType::String(None).def().null(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Status => ReturnStatuses :: db_type () . def () , Self :: SwapId => ColumnType :: String (None) . def () . null () . unique () , Self :: OrderId => ColumnType :: String (None) . def () . null () , Self :: ShippingData => ColumnType :: JsonBinary . def () . null () , Self :: RefundAmount => ColumnType :: Integer . def () , Self :: ReceivedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: IdempotencyKey => ColumnType :: String (None) . def () . null () , Self :: ClaimOrderId => ColumnType :: String (None) . def () . null () . unique () , Self :: NoNotification => ColumnType :: Boolean . def () . null () , Self :: LocationId => ColumnType :: String (None) . def () . null () , } } } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ClaimOrders => Entity::belongs_to(super::claim_orders::Entity) + .from(Column::ClaimOrderId) + .to(super::claim_orders::Column::Id) + .into(), + Self::Orders => Entity::belongs_to(super::orders::Entity) + .from(Column::OrderId) + .to(super::orders::Column::Id) + .into(), + Self::ReturnItems => Entity::has_many(super::return_items::Entity).into(), + Self::ShippingMethods => Entity::has_one(super::shipping_methods::Entity).into(), + Self::Swaps => Entity::belongs_to(super::swaps::Entity) + .from(Column::SwapId) + .to(super::swaps::Column::Id) + .into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ClaimOrders => Entity :: belongs_to (super :: claim_orders :: Entity) . from (Column :: ClaimOrderId) . to (super :: claim_orders :: Column :: Id) . into () , Self :: Orders => Entity :: belongs_to (super :: orders :: Entity) . from (Column :: OrderId) . to (super :: orders :: Column :: Id) . into () , Self :: ReturnItems => Entity :: has_many (super :: return_items :: Entity) . into () , Self :: ShippingMethods => Entity :: has_one (super :: shipping_methods :: Entity) . into () , Self :: Swaps => Entity :: belongs_to (super :: swaps :: Entity) . from (Column :: SwapId) . to (super :: swaps :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ClaimOrders.def() + } +} -impl Related < super :: claim_orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: ClaimOrders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Orders.def() + } +} -impl Related < super :: orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: Orders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ReturnItems.def() + } +} -impl Related < super :: return_items :: Entity > for Entity { fn to () -> RelationDef { Relation :: ReturnItems . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingMethods.def() + } +} -impl Related < super :: shipping_methods :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingMethods . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Swaps.def() + } +} -impl Related < super :: swaps :: Entity > for Entity { fn to () -> RelationDef { Relation :: Swaps . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/sales_channel_locations.rs b/crates/model/src/v4/sales_channel_locations.rs index f0e0583..3dfb71d 100644 --- a/crates/model/src/v4/sales_channel_locations.rs +++ b/crates/model/src/v4/sales_channel_locations.rs @@ -1,25 +1,70 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "sales_channel_locations" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub sales_channel_id: String, + pub location_id: String, + pub deleted_at: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "sales_channel_locations" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + CreatedAt, + UpdatedAt, + SalesChannelId, + LocationId, + DeletedAt, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub sales_channel_id : String , pub location_id : String , pub deleted_at : Option < DateTimeWithTimeZone > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , CreatedAt , UpdatedAt , SalesChannelId , LocationId , DeletedAt , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::SalesChannelId => ColumnType::Text.def(), + Self::LocationId => ColumnType::Text.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: SalesChannelId => ColumnType :: Text . def () , Self :: LocationId => ColumnType :: Text . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , } } } - -impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/sales_channels.rs b/crates/model/src/v4/sales_channels.rs index 52eb897..89cc61c 100644 --- a/crates/model/src/v4/sales_channels.rs +++ b/crates/model/src/v4/sales_channels.rs @@ -1,33 +1,115 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "sales_channels" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub name: String, + pub description: Option, + pub is_disabled: bool, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "sales_channels" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + CreatedAt, + UpdatedAt, + DeletedAt, + Name, + Description, + IsDisabled, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub name : String , pub description : Option < String > , pub is_disabled : bool , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , CreatedAt , UpdatedAt , DeletedAt , Name , Description , IsDisabled , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Carts, + Orders, + Stores, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Name => ColumnType::String(None).def(), + Self::Description => ColumnType::String(None).def().null(), + Self::IsDisabled => ColumnType::Boolean.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Carts , Orders , Stores , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Carts => Entity::has_many(super::carts::Entity).into(), + Self::Orders => Entity::has_many(super::orders::Entity).into(), + Self::Stores => Entity::has_one(super::stores::Entity).into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Name => ColumnType :: String (None) . def () , Self :: Description => ColumnType :: String (None) . def () . null () , Self :: IsDisabled => ColumnType :: Boolean . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Carts.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Carts => Entity :: has_many (super :: carts :: Entity) . into () , Self :: Orders => Entity :: has_many (super :: orders :: Entity) . into () , Self :: Stores => Entity :: has_one (super :: stores :: Entity) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Orders.def() + } +} -impl Related < super :: carts :: Entity > for Entity { fn to () -> RelationDef { Relation :: Carts . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Stores.def() + } +} -impl Related < super :: orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: Orders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_sales_channels::Relation::Products.def() + } + fn via() -> Option { + Some( + super::product_sales_channels::Relation::SalesChannels + .def() + .rev(), + ) + } +} -impl Related < super :: stores :: Entity > for Entity { fn to () -> RelationDef { Relation :: Stores . def () } } - -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { super :: product_sales_channels :: Relation :: Products . def () } fn via () -> Option < RelationDef > { Some (super :: product_sales_channels :: Relation :: SalesChannels . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/sea_orm_active_enums.rs b/crates/model/src/v4/sea_orm_active_enums.rs index d44ded7..a7f9302 100644 --- a/crates/model/src/v4/sea_orm_active_enums.rs +++ b/crates/model/src/v4/sea_orm_active_enums.rs @@ -1,33 +1,431 @@ //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +use sea_orm::entity::prelude::*; +use serde::{Deserialize, Serialize}; -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "cart_types")] pub enum CartTypes { # [sea_orm (string_value = "claim")] Claim , # [sea_orm (string_value = "default")] Default , # [sea_orm (string_value = "draft_order")] DraftOrder , # [sea_orm (string_value = "payment_link")] PaymentLink , # [sea_orm (string_value = "swap")] Swap , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "claim_item_reasons")] pub enum ClaimItemReasons { # [sea_orm (string_value = "missing_item")] MissingItem , # [sea_orm (string_value = "other")] Other , # [sea_orm (string_value = "production_failure")] ProductionFailure , # [sea_orm (string_value = "wrong_item")] WrongItem , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "claim_order_fulfillment_statuses")] pub enum ClaimOrderFulfillmentStatuses { # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "fulfilled")] Fulfilled , # [sea_orm (string_value = "not_fulfilled")] NotFulfilled , # [sea_orm (string_value = "partially_fulfilled")] PartiallyFulfilled , # [sea_orm (string_value = "partially_returned")] PartiallyReturned , # [sea_orm (string_value = "partially_shipped")] PartiallyShipped , # [sea_orm (string_value = "requires_action")] RequiresAction , # [sea_orm (string_value = "returned")] Returned , # [sea_orm (string_value = "shipped")] Shipped , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "claim_order_payment_statuses")] pub enum ClaimOrderPaymentStatuses { # [sea_orm (string_value = "na")] Na , # [sea_orm (string_value = "not_refunded")] NotRefunded , # [sea_orm (string_value = "refunded")] Refunded , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "claim_order_types")] pub enum ClaimOrderTypes { # [sea_orm (string_value = "refund")] Refund , # [sea_orm (string_value = "replace")] Replace , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "discount_condition_operators")] pub enum DiscountConditionOperators { # [sea_orm (string_value = "in")] In , # [sea_orm (string_value = "not_in")] NotIn , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "discount_condition_types")] pub enum DiscountConditionTypes { # [sea_orm (string_value = "customer_groups")] CustomerGroups , # [sea_orm (string_value = "product_collections")] ProductCollections , # [sea_orm (string_value = "product_tags")] ProductTags , # [sea_orm (string_value = "product_types")] ProductTypes , # [sea_orm (string_value = "products")] Products , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "discount_rule_allocations")] pub enum DiscountRuleAllocations { # [sea_orm (string_value = "item")] Item , # [sea_orm (string_value = "total")] Total , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "discount_rule_types")] pub enum DiscountRuleTypes { # [sea_orm (string_value = "fixed")] Fixed , # [sea_orm (string_value = "free_shipping")] FreeShipping , # [sea_orm (string_value = "percentage")] Percentage , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "draft_order_statuses")] pub enum DraftOrderStatuses { # [sea_orm (string_value = "completed")] Completed , # [sea_orm (string_value = "open")] Open , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "invite_roles")] pub enum InviteRoles { # [sea_orm (string_value = "admin")] Admin , # [sea_orm (string_value = "developer")] Developer , # [sea_orm (string_value = "member")] Member , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "order_fulfillment_statuses")] pub enum OrderFulfillmentStatuses { # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "fulfilled")] Fulfilled , # [sea_orm (string_value = "not_fulfilled")] NotFulfilled , # [sea_orm (string_value = "partially_fulfilled")] PartiallyFulfilled , # [sea_orm (string_value = "partially_returned")] PartiallyReturned , # [sea_orm (string_value = "partially_shipped")] PartiallyShipped , # [sea_orm (string_value = "requires_action")] RequiresAction , # [sea_orm (string_value = "returned")] Returned , # [sea_orm (string_value = "shipped")] Shipped , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "order_item_change_types")] pub enum OrderItemChangeTypes { # [sea_orm (string_value = "item_add")] ItemAdd , # [sea_orm (string_value = "item_remove")] ItemRemove , # [sea_orm (string_value = "item_update")] ItemUpdate , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "order_payment_statuses")] pub enum OrderPaymentStatuses { # [sea_orm (string_value = "awaiting")] Awaiting , # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "captured")] Captured , # [sea_orm (string_value = "not_paid")] NotPaid , # [sea_orm (string_value = "partially_refunded")] PartiallyRefunded , # [sea_orm (string_value = "refunded")] Refunded , # [sea_orm (string_value = "requires_action")] RequiresAction , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "order_statuses")] pub enum OrderStatuses { # [sea_orm (string_value = "archived")] Archived , # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "completed")] Completed , # [sea_orm (string_value = "pending")] Pending , # [sea_orm (string_value = "requires_action")] RequiresAction , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "payment_collection_statuses")] pub enum PaymentCollectionStatuses { # [sea_orm (string_value = "authorized")] Authorized , # [sea_orm (string_value = "awaiting")] Awaiting , # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "not_paid")] NotPaid , # [sea_orm (string_value = "partially_authorized")] PartiallyAuthorized , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "payment_collection_types")] pub enum PaymentCollectionTypes { # [sea_orm (string_value = "order_edit")] OrderEdit , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "payment_session_statuses")] pub enum PaymentSessionStatuses { # [sea_orm (string_value = "authorized")] Authorized , # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "error")] Error , # [sea_orm (string_value = "pending")] Pending , # [sea_orm (string_value = "requires_more")] RequiresMore , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "price_list_statuses")] pub enum PriceListStatuses { # [sea_orm (string_value = "active")] Active , # [sea_orm (string_value = "draft")] Draft , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "price_list_types")] pub enum PriceListTypes { # [sea_orm (string_value = "override")] Override , # [sea_orm (string_value = "sale")] Sale , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "product_statuses")] pub enum ProductStatuses { # [sea_orm (string_value = "draft")] Draft , # [sea_orm (string_value = "proposed")] Proposed , # [sea_orm (string_value = "published")] Published , # [sea_orm (string_value = "rejected")] Rejected , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "refund_reasons")] pub enum RefundReasons { # [sea_orm (string_value = "claim")] Claim , # [sea_orm (string_value = "discount")] Discount , # [sea_orm (string_value = "other")] Other , # [sea_orm (string_value = "return")] Return , # [sea_orm (string_value = "swap")] Swap , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "return_statuses")] pub enum ReturnStatuses { # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "received")] Received , # [sea_orm (string_value = "requested")] Requested , # [sea_orm (string_value = "requires_action")] RequiresAction , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "shipping_option_price_types")] pub enum ShippingOptionPriceTypes { # [sea_orm (string_value = "calculated")] Calculated , # [sea_orm (string_value = "flat_rate")] FlatRate , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "shipping_option_requirement_types")] pub enum ShippingOptionRequirementTypes { # [sea_orm (string_value = "max_subtotal")] MaxSubtotal , # [sea_orm (string_value = "min_subtotal")] MinSubtotal , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "shipping_profile_types")] pub enum ShippingProfileTypes { # [sea_orm (string_value = "custom")] Custom , # [sea_orm (string_value = "default")] Default , # [sea_orm (string_value = "gift_card")] GiftCard , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "swap_fulfillment_statuses")] pub enum SwapFulfillmentStatuses { # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "fulfilled")] Fulfilled , # [sea_orm (string_value = "not_fulfilled")] NotFulfilled , # [sea_orm (string_value = "partially_shipped")] PartiallyShipped , # [sea_orm (string_value = "requires_action")] RequiresAction , # [sea_orm (string_value = "shipped")] Shipped , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "swap_payment_statuses")] pub enum SwapPaymentStatuses { # [sea_orm (string_value = "awaiting")] Awaiting , # [sea_orm (string_value = "canceled")] Canceled , # [sea_orm (string_value = "captured")] Captured , # [sea_orm (string_value = "confirmed")] Confirmed , # [sea_orm (string_value = "difference_refunded")] DifferenceRefunded , # [sea_orm (string_value = "not_paid")] NotPaid , # [sea_orm (string_value = "partially_refunded")] PartiallyRefunded , # [sea_orm (string_value = "refunded")] Refunded , # [sea_orm (string_value = "requires_action")] RequiresAction , } -# [derive (Debug , Clone , PartialEq , Eq , EnumIter , DeriveActiveEnum , Serialize , Deserialize)] # [sea_orm (rs_type = "String" , db_type = "Enum" , enum_name = "user_roles")] pub enum UserRoles { # [sea_orm (string_value = "admin")] Admin , # [sea_orm (string_value = "developer")] Developer , # [sea_orm (string_value = "member")] Member , } \ No newline at end of file +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "cart_types")] +pub enum CartTypes { + #[sea_orm(string_value = "claim")] + Claim, + #[sea_orm(string_value = "default")] + Default, + #[sea_orm(string_value = "draft_order")] + DraftOrder, + #[sea_orm(string_value = "payment_link")] + PaymentLink, + #[sea_orm(string_value = "swap")] + Swap, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "claim_item_reasons")] +pub enum ClaimItemReasons { + #[sea_orm(string_value = "missing_item")] + MissingItem, + #[sea_orm(string_value = "other")] + Other, + #[sea_orm(string_value = "production_failure")] + ProductionFailure, + #[sea_orm(string_value = "wrong_item")] + WrongItem, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "claim_order_fulfillment_statuses" +)] +pub enum ClaimOrderFulfillmentStatuses { + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "fulfilled")] + Fulfilled, + #[sea_orm(string_value = "not_fulfilled")] + NotFulfilled, + #[sea_orm(string_value = "partially_fulfilled")] + PartiallyFulfilled, + #[sea_orm(string_value = "partially_returned")] + PartiallyReturned, + #[sea_orm(string_value = "partially_shipped")] + PartiallyShipped, + #[sea_orm(string_value = "requires_action")] + RequiresAction, + #[sea_orm(string_value = "returned")] + Returned, + #[sea_orm(string_value = "shipped")] + Shipped, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "claim_order_payment_statuses" +)] +pub enum ClaimOrderPaymentStatuses { + #[sea_orm(string_value = "na")] + Na, + #[sea_orm(string_value = "not_refunded")] + NotRefunded, + #[sea_orm(string_value = "refunded")] + Refunded, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "claim_order_types")] +pub enum ClaimOrderTypes { + #[sea_orm(string_value = "refund")] + Refund, + #[sea_orm(string_value = "replace")] + Replace, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "discount_condition_operators" +)] +pub enum DiscountConditionOperators { + #[sea_orm(string_value = "in")] + In, + #[sea_orm(string_value = "not_in")] + NotIn, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "discount_condition_types" +)] +pub enum DiscountConditionTypes { + #[sea_orm(string_value = "customer_groups")] + CustomerGroups, + #[sea_orm(string_value = "product_collections")] + ProductCollections, + #[sea_orm(string_value = "product_tags")] + ProductTags, + #[sea_orm(string_value = "product_types")] + ProductTypes, + #[sea_orm(string_value = "products")] + Products, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "discount_rule_allocations" +)] +pub enum DiscountRuleAllocations { + #[sea_orm(string_value = "item")] + Item, + #[sea_orm(string_value = "total")] + Total, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "discount_rule_types" +)] +pub enum DiscountRuleTypes { + #[sea_orm(string_value = "fixed")] + Fixed, + #[sea_orm(string_value = "free_shipping")] + FreeShipping, + #[sea_orm(string_value = "percentage")] + Percentage, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "draft_order_statuses" +)] +pub enum DraftOrderStatuses { + #[sea_orm(string_value = "completed")] + Completed, + #[sea_orm(string_value = "open")] + Open, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "invite_roles")] +pub enum InviteRoles { + #[sea_orm(string_value = "admin")] + Admin, + #[sea_orm(string_value = "developer")] + Developer, + #[sea_orm(string_value = "member")] + Member, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "order_fulfillment_statuses" +)] +pub enum OrderFulfillmentStatuses { + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "fulfilled")] + Fulfilled, + #[sea_orm(string_value = "not_fulfilled")] + NotFulfilled, + #[sea_orm(string_value = "partially_fulfilled")] + PartiallyFulfilled, + #[sea_orm(string_value = "partially_returned")] + PartiallyReturned, + #[sea_orm(string_value = "partially_shipped")] + PartiallyShipped, + #[sea_orm(string_value = "requires_action")] + RequiresAction, + #[sea_orm(string_value = "returned")] + Returned, + #[sea_orm(string_value = "shipped")] + Shipped, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "order_item_change_types" +)] +pub enum OrderItemChangeTypes { + #[sea_orm(string_value = "item_add")] + ItemAdd, + #[sea_orm(string_value = "item_remove")] + ItemRemove, + #[sea_orm(string_value = "item_update")] + ItemUpdate, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "order_payment_statuses" +)] +pub enum OrderPaymentStatuses { + #[sea_orm(string_value = "awaiting")] + Awaiting, + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "captured")] + Captured, + #[sea_orm(string_value = "not_paid")] + NotPaid, + #[sea_orm(string_value = "partially_refunded")] + PartiallyRefunded, + #[sea_orm(string_value = "refunded")] + Refunded, + #[sea_orm(string_value = "requires_action")] + RequiresAction, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "order_statuses")] +pub enum OrderStatuses { + #[sea_orm(string_value = "archived")] + Archived, + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "completed")] + Completed, + #[sea_orm(string_value = "pending")] + Pending, + #[sea_orm(string_value = "requires_action")] + RequiresAction, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "payment_collection_statuses" +)] +pub enum PaymentCollectionStatuses { + #[sea_orm(string_value = "authorized")] + Authorized, + #[sea_orm(string_value = "awaiting")] + Awaiting, + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "not_paid")] + NotPaid, + #[sea_orm(string_value = "partially_authorized")] + PartiallyAuthorized, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "payment_collection_types" +)] +pub enum PaymentCollectionTypes { + #[sea_orm(string_value = "order_edit")] + OrderEdit, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "payment_session_statuses" +)] +pub enum PaymentSessionStatuses { + #[sea_orm(string_value = "authorized")] + Authorized, + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "error")] + Error, + #[sea_orm(string_value = "pending")] + Pending, + #[sea_orm(string_value = "requires_more")] + RequiresMore, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "price_list_statuses" +)] +pub enum PriceListStatuses { + #[sea_orm(string_value = "active")] + Active, + #[sea_orm(string_value = "draft")] + Draft, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "price_list_types")] +pub enum PriceListTypes { + #[sea_orm(string_value = "override")] + Override, + #[sea_orm(string_value = "sale")] + Sale, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "product_statuses")] +pub enum ProductStatuses { + #[sea_orm(string_value = "draft")] + Draft, + #[sea_orm(string_value = "proposed")] + Proposed, + #[sea_orm(string_value = "published")] + Published, + #[sea_orm(string_value = "rejected")] + Rejected, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "refund_reasons")] +pub enum RefundReasons { + #[sea_orm(string_value = "claim")] + Claim, + #[sea_orm(string_value = "discount")] + Discount, + #[sea_orm(string_value = "other")] + Other, + #[sea_orm(string_value = "return")] + Return, + #[sea_orm(string_value = "swap")] + Swap, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "return_statuses")] +pub enum ReturnStatuses { + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "received")] + Received, + #[sea_orm(string_value = "requested")] + Requested, + #[sea_orm(string_value = "requires_action")] + RequiresAction, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "shipping_option_price_types" +)] +pub enum ShippingOptionPriceTypes { + #[sea_orm(string_value = "calculated")] + Calculated, + #[sea_orm(string_value = "flat_rate")] + FlatRate, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "shipping_option_requirement_types" +)] +pub enum ShippingOptionRequirementTypes { + #[sea_orm(string_value = "max_subtotal")] + MaxSubtotal, + #[sea_orm(string_value = "min_subtotal")] + MinSubtotal, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "shipping_profile_types" +)] +pub enum ShippingProfileTypes { + #[sea_orm(string_value = "custom")] + Custom, + #[sea_orm(string_value = "default")] + Default, + #[sea_orm(string_value = "gift_card")] + GiftCard, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "swap_fulfillment_statuses" +)] +pub enum SwapFulfillmentStatuses { + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "fulfilled")] + Fulfilled, + #[sea_orm(string_value = "not_fulfilled")] + NotFulfilled, + #[sea_orm(string_value = "partially_shipped")] + PartiallyShipped, + #[sea_orm(string_value = "requires_action")] + RequiresAction, + #[sea_orm(string_value = "shipped")] + Shipped, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm( + rs_type = "String", + db_type = "Enum", + enum_name = "swap_payment_statuses" +)] +pub enum SwapPaymentStatuses { + #[sea_orm(string_value = "awaiting")] + Awaiting, + #[sea_orm(string_value = "canceled")] + Canceled, + #[sea_orm(string_value = "captured")] + Captured, + #[sea_orm(string_value = "confirmed")] + Confirmed, + #[sea_orm(string_value = "difference_refunded")] + DifferenceRefunded, + #[sea_orm(string_value = "not_paid")] + NotPaid, + #[sea_orm(string_value = "partially_refunded")] + PartiallyRefunded, + #[sea_orm(string_value = "refunded")] + Refunded, + #[sea_orm(string_value = "requires_action")] + RequiresAction, +} +#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] +#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "user_roles")] +pub enum UserRoles { + #[sea_orm(string_value = "admin")] + Admin, + #[sea_orm(string_value = "developer")] + Developer, + #[sea_orm(string_value = "member")] + Member, +} diff --git a/crates/model/src/v4/shipping_method_tax_lines.rs b/crates/model/src/v4/shipping_method_tax_lines.rs index 6f3b257..8431330 100644 --- a/crates/model/src/v4/shipping_method_tax_lines.rs +++ b/crates/model/src/v4/shipping_method_tax_lines.rs @@ -1,27 +1,89 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "shipping_method_tax_lines" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub rate: f32, + pub name: String, + pub code: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, + pub shipping_method_id: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "shipping_method_tax_lines" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Rate, + Name, + Code, + CreatedAt, + UpdatedAt, + Metadata, + ShippingMethodId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Serialize , Deserialize)] pub struct Model { pub id : String , pub rate : f32 , pub name : String , pub code : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , pub shipping_method_id : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Rate , Name , Code , CreatedAt , UpdatedAt , Metadata , ShippingMethodId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ShippingMethods, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Rate => ColumnType::Float.def(), + Self::Name => ColumnType::String(None).def(), + Self::Code => ColumnType::String(None).def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::ShippingMethodId => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ShippingMethods , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ShippingMethods => Entity::belongs_to(super::shipping_methods::Entity) + .from(Column::ShippingMethodId) + .to(super::shipping_methods::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Rate => ColumnType :: Float . def () , Self :: Name => ColumnType :: String (None) . def () , Self :: Code => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: ShippingMethodId => ColumnType :: String (None) . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingMethods.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ShippingMethods => Entity :: belongs_to (super :: shipping_methods :: Entity) . from (Column :: ShippingMethodId) . to (super :: shipping_methods :: Column :: Id) . into () , } } } - -impl Related < super :: shipping_methods :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingMethods . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/shipping_methods.rs b/crates/model/src/v4/shipping_methods.rs index e815a2b..83efc1f 100644 --- a/crates/model/src/v4/shipping_methods.rs +++ b/crates/model/src/v4/shipping_methods.rs @@ -1,39 +1,157 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "shipping_methods" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub shipping_option_id: String, + pub order_id: Option, + pub cart_id: Option, + pub swap_id: Option, + pub return_id: Option, + pub price: i32, + pub data: Json, + pub claim_order_id: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "shipping_methods" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + ShippingOptionId, + OrderId, + CartId, + SwapId, + ReturnId, + Price, + Data, + ClaimOrderId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub shipping_option_id : String , pub order_id : Option < String > , pub cart_id : Option < String > , pub swap_id : Option < String > , pub return_id : Option < String > , pub price : i32 , pub data : Json , pub claim_order_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , ShippingOptionId , OrderId , CartId , SwapId , ReturnId , Price , Data , ClaimOrderId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Carts, + ClaimOrders, + Orders, + Returns, + ShippingMethodTaxLines, + ShippingOptions, + Swaps, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::ShippingOptionId => ColumnType::String(None).def(), + Self::OrderId => ColumnType::String(None).def().null(), + Self::CartId => ColumnType::String(None).def().null(), + Self::SwapId => ColumnType::String(None).def().null(), + Self::ReturnId => ColumnType::String(None).def().null().unique(), + Self::Price => ColumnType::Integer.def(), + Self::Data => ColumnType::JsonBinary.def(), + Self::ClaimOrderId => ColumnType::String(None).def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Carts , ClaimOrders , Orders , Returns , ShippingMethodTaxLines , ShippingOptions , Swaps , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Carts => Entity::belongs_to(super::carts::Entity) + .from(Column::CartId) + .to(super::carts::Column::Id) + .into(), + Self::ClaimOrders => Entity::belongs_to(super::claim_orders::Entity) + .from(Column::ClaimOrderId) + .to(super::claim_orders::Column::Id) + .into(), + Self::Orders => Entity::belongs_to(super::orders::Entity) + .from(Column::OrderId) + .to(super::orders::Column::Id) + .into(), + Self::Returns => Entity::belongs_to(super::returns::Entity) + .from(Column::ReturnId) + .to(super::returns::Column::Id) + .into(), + Self::ShippingMethodTaxLines => { + Entity::has_many(super::shipping_method_tax_lines::Entity).into() + } + Self::ShippingOptions => Entity::belongs_to(super::shipping_options::Entity) + .from(Column::ShippingOptionId) + .to(super::shipping_options::Column::Id) + .into(), + Self::Swaps => Entity::belongs_to(super::swaps::Entity) + .from(Column::SwapId) + .to(super::swaps::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: ShippingOptionId => ColumnType :: String (None) . def () , Self :: OrderId => ColumnType :: String (None) . def () . null () , Self :: CartId => ColumnType :: String (None) . def () . null () , Self :: SwapId => ColumnType :: String (None) . def () . null () , Self :: ReturnId => ColumnType :: String (None) . def () . null () . unique () , Self :: Price => ColumnType :: Integer . def () , Self :: Data => ColumnType :: JsonBinary . def () , Self :: ClaimOrderId => ColumnType :: String (None) . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Carts.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Carts => Entity :: belongs_to (super :: carts :: Entity) . from (Column :: CartId) . to (super :: carts :: Column :: Id) . into () , Self :: ClaimOrders => Entity :: belongs_to (super :: claim_orders :: Entity) . from (Column :: ClaimOrderId) . to (super :: claim_orders :: Column :: Id) . into () , Self :: Orders => Entity :: belongs_to (super :: orders :: Entity) . from (Column :: OrderId) . to (super :: orders :: Column :: Id) . into () , Self :: Returns => Entity :: belongs_to (super :: returns :: Entity) . from (Column :: ReturnId) . to (super :: returns :: Column :: Id) . into () , Self :: ShippingMethodTaxLines => Entity :: has_many (super :: shipping_method_tax_lines :: Entity) . into () , Self :: ShippingOptions => Entity :: belongs_to (super :: shipping_options :: Entity) . from (Column :: ShippingOptionId) . to (super :: shipping_options :: Column :: Id) . into () , Self :: Swaps => Entity :: belongs_to (super :: swaps :: Entity) . from (Column :: SwapId) . to (super :: swaps :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ClaimOrders.def() + } +} -impl Related < super :: carts :: Entity > for Entity { fn to () -> RelationDef { Relation :: Carts . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Orders.def() + } +} -impl Related < super :: claim_orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: ClaimOrders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Returns.def() + } +} -impl Related < super :: orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: Orders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingMethodTaxLines.def() + } +} -impl Related < super :: returns :: Entity > for Entity { fn to () -> RelationDef { Relation :: Returns . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingOptions.def() + } +} -impl Related < super :: shipping_method_tax_lines :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingMethodTaxLines . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Swaps.def() + } +} -impl Related < super :: shipping_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingOptions . def () } } - -impl Related < super :: swaps :: Entity > for Entity { fn to () -> RelationDef { Relation :: Swaps . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/shipping_option_requirements.rs b/crates/model/src/v4/shipping_option_requirements.rs index 5061031..500ea5d 100644 --- a/crates/model/src/v4/shipping_option_requirements.rs +++ b/crates/model/src/v4/shipping_option_requirements.rs @@ -1,27 +1,82 @@ //! `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::ShippingOptionRequirementTypes; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: ShippingOptionRequirementTypes ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "shipping_option_requirements" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "shipping_option_requirements" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub shipping_option_id: String, + pub r#type: ShippingOptionRequirementTypes, + pub amount: i32, + pub deleted_at: Option, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub shipping_option_id : String , pub r#type : ShippingOptionRequirementTypes , pub amount : i32 , pub deleted_at : Option < DateTimeWithTimeZone > , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + ShippingOptionId, + Type, + Amount, + DeletedAt, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , ShippingOptionId , Type , Amount , DeletedAt , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ShippingOptions, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ShippingOptions , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::ShippingOptionId => ColumnType::String(None).def(), + Self::Type => ShippingOptionRequirementTypes::db_type().def(), + Self::Amount => ColumnType::Integer.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: ShippingOptionId => ColumnType :: String (None) . def () , Self :: Type => ShippingOptionRequirementTypes :: db_type () . def () , Self :: Amount => ColumnType :: Integer . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , } } } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ShippingOptions => Entity::belongs_to(super::shipping_options::Entity) + .from(Column::ShippingOptionId) + .to(super::shipping_options::Column::Id) + .into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ShippingOptions => Entity :: belongs_to (super :: shipping_options :: Entity) . from (Column :: ShippingOptionId) . to (super :: shipping_options :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingOptions.def() + } +} -impl Related < super :: shipping_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingOptions . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/shipping_options.rs b/crates/model/src/v4/shipping_options.rs index beabfdd..6b69ce8 100644 --- a/crates/model/src/v4/shipping_options.rs +++ b/crates/model/src/v4/shipping_options.rs @@ -1,39 +1,172 @@ //! `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::ShippingOptionPriceTypes; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: ShippingOptionPriceTypes ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "shipping_options" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "shipping_options" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub name: String, + pub region_id: String, + pub profile_id: String, + pub provider_id: String, + pub price_type: ShippingOptionPriceTypes, + pub amount: Option, + pub is_return: bool, + pub data: Json, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub admin_only: bool, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub name : String , pub region_id : String , pub profile_id : String , pub provider_id : String , pub price_type : ShippingOptionPriceTypes , pub amount : Option < i32 > , pub is_return : bool , pub data : Json , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub admin_only : bool , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Name, + RegionId, + ProfileId, + ProviderId, + PriceType, + Amount, + IsReturn, + Data, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + AdminOnly, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Name , RegionId , ProfileId , ProviderId , PriceType , Amount , IsReturn , Data , CreatedAt , UpdatedAt , DeletedAt , Metadata , AdminOnly , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + CustomShippingOptions, + FulfillmentProviders, + Regions, + ShippingMethods, + ShippingOptionRequirements, + ShippingProfiles, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { CustomShippingOptions , FulfillmentProviders , Regions , ShippingMethods , ShippingOptionRequirements , ShippingProfiles , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Name => ColumnType::String(None).def(), + Self::RegionId => ColumnType::String(None).def(), + Self::ProfileId => ColumnType::String(None).def(), + Self::ProviderId => ColumnType::String(None).def(), + Self::PriceType => ShippingOptionPriceTypes::db_type().def(), + Self::Amount => ColumnType::Integer.def().null(), + Self::IsReturn => ColumnType::Boolean.def(), + Self::Data => ColumnType::JsonBinary.def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::AdminOnly => ColumnType::Boolean.def(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Name => ColumnType :: String (None) . def () , Self :: RegionId => ColumnType :: String (None) . def () , Self :: ProfileId => ColumnType :: String (None) . def () , Self :: ProviderId => ColumnType :: String (None) . def () , Self :: PriceType => ShippingOptionPriceTypes :: db_type () . def () , Self :: Amount => ColumnType :: Integer . def () . null () , Self :: IsReturn => ColumnType :: Boolean . def () , Self :: Data => ColumnType :: JsonBinary . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: AdminOnly => ColumnType :: Boolean . def () , } } } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::CustomShippingOptions => { + Entity::has_many(super::custom_shipping_options::Entity).into() + } + Self::FulfillmentProviders => Entity::belongs_to(super::fulfillment_providers::Entity) + .from(Column::ProviderId) + .to(super::fulfillment_providers::Column::Id) + .into(), + Self::Regions => Entity::belongs_to(super::regions::Entity) + .from(Column::RegionId) + .to(super::regions::Column::Id) + .into(), + Self::ShippingMethods => Entity::has_many(super::shipping_methods::Entity).into(), + Self::ShippingOptionRequirements => { + Entity::has_many(super::shipping_option_requirements::Entity).into() + } + Self::ShippingProfiles => Entity::belongs_to(super::shipping_profiles::Entity) + .from(Column::ProfileId) + .to(super::shipping_profiles::Column::Id) + .into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: CustomShippingOptions => Entity :: has_many (super :: custom_shipping_options :: Entity) . into () , Self :: FulfillmentProviders => Entity :: belongs_to (super :: fulfillment_providers :: Entity) . from (Column :: ProviderId) . to (super :: fulfillment_providers :: Column :: Id) . into () , Self :: Regions => Entity :: belongs_to (super :: regions :: Entity) . from (Column :: RegionId) . to (super :: regions :: Column :: Id) . into () , Self :: ShippingMethods => Entity :: has_many (super :: shipping_methods :: Entity) . into () , Self :: ShippingOptionRequirements => Entity :: has_many (super :: shipping_option_requirements :: Entity) . into () , Self :: ShippingProfiles => Entity :: belongs_to (super :: shipping_profiles :: Entity) . from (Column :: ProfileId) . to (super :: shipping_profiles :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::CustomShippingOptions.def() + } +} -impl Related < super :: custom_shipping_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: CustomShippingOptions . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::FulfillmentProviders.def() + } +} -impl Related < super :: fulfillment_providers :: Entity > for Entity { fn to () -> RelationDef { Relation :: FulfillmentProviders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Regions.def() + } +} -impl Related < super :: regions :: Entity > for Entity { fn to () -> RelationDef { Relation :: Regions . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingMethods.def() + } +} -impl Related < super :: shipping_methods :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingMethods . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingOptionRequirements.def() + } +} -impl Related < super :: shipping_option_requirements :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingOptionRequirements . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingProfiles.def() + } +} -impl Related < super :: shipping_profiles :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingProfiles . def () } } +impl Related for Entity { + fn to() -> RelationDef { + super::shipping_tax_rates::Relation::TaxRates.def() + } + fn via() -> Option { + Some( + super::shipping_tax_rates::Relation::ShippingOptions + .def() + .rev(), + ) + } +} -impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { super :: shipping_tax_rates :: Relation :: TaxRates . def () } fn via () -> Option < RelationDef > { Some (super :: shipping_tax_rates :: Relation :: ShippingOptions . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/shipping_profiles.rs b/crates/model/src/v4/shipping_profiles.rs index ca8924f..acbe1ab 100644 --- a/crates/model/src/v4/shipping_profiles.rs +++ b/crates/model/src/v4/shipping_profiles.rs @@ -1,29 +1,93 @@ //! `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::ShippingProfileTypes; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: ShippingProfileTypes ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "shipping_profiles" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "shipping_profiles" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub name: String, + pub r#type: ShippingProfileTypes, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub name : String , pub r#type : ShippingProfileTypes , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Name, + Type, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Name , Type , CreatedAt , UpdatedAt , DeletedAt , Metadata , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Products, + ShippingOptions, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , ShippingOptions , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Name => ColumnType::String(None).def(), + Self::Type => ShippingProfileTypes::db_type().def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Name => ColumnType :: String (None) . def () , Self :: Type => ShippingProfileTypes :: db_type () . 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::Products => Entity::has_many(super::products::Entity).into(), + Self::ShippingOptions => Entity::has_many(super::shipping_options::Entity).into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: has_many (super :: products :: Entity) . into () , Self :: ShippingOptions => Entity :: has_many (super :: shipping_options :: Entity) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Products.def() + } +} -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingOptions.def() + } +} -impl Related < super :: shipping_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingOptions . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/shipping_tax_rates.rs b/crates/model/src/v4/shipping_tax_rates.rs index 8b1f532..eb6cf88 100644 --- a/crates/model/src/v4/shipping_tax_rates.rs +++ b/crates/model/src/v4/shipping_tax_rates.rs @@ -1,29 +1,92 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "shipping_tax_rates" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub shipping_option_id: String, + pub rate_id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "shipping_tax_rates" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + ShippingOptionId, + RateId, + CreatedAt, + UpdatedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub shipping_option_id : String , pub rate_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + ShippingOptionId, + RateId, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ShippingOptionId , RateId , CreatedAt , UpdatedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ShippingOptionId , RateId , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + ShippingOptions, + TaxRates, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::ShippingOptionId => ColumnType::String(None).def(), + Self::RateId => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ShippingOptions , TaxRates , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::ShippingOptions => Entity::belongs_to(super::shipping_options::Entity) + .from(Column::ShippingOptionId) + .to(super::shipping_options::Column::Id) + .into(), + Self::TaxRates => Entity::belongs_to(super::tax_rates::Entity) + .from(Column::RateId) + .to(super::tax_rates::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ShippingOptionId => ColumnType :: String (None) . def () , Self :: RateId => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingOptions.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ShippingOptions => Entity :: belongs_to (super :: shipping_options :: Entity) . from (Column :: ShippingOptionId) . to (super :: shipping_options :: Column :: Id) . into () , Self :: TaxRates => Entity :: belongs_to (super :: tax_rates :: Entity) . from (Column :: RateId) . to (super :: tax_rates :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::TaxRates.def() + } +} -impl Related < super :: shipping_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingOptions . def () } } - -impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { Relation :: TaxRates . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/staged_jobs.rs b/crates/model/src/v4/staged_jobs.rs index c61dfcc..a2074eb 100644 --- a/crates/model/src/v4/staged_jobs.rs +++ b/crates/model/src/v4/staged_jobs.rs @@ -1,25 +1,64 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "staged_jobs" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub event_name: String, + pub data: Json, + pub options: Json, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "staged_jobs" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + EventName, + Data, + Options, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub event_name : String , pub data : Json , pub options : Json , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , EventName , Data , Options , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation {} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::EventName => ColumnType::String(None).def(), + Self::Data => ColumnType::JsonBinary.def(), + Self::Options => ColumnType::JsonBinary.def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + panic!("No RelationDef") + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: EventName => ColumnType :: String (None) . def () , Self :: Data => ColumnType :: JsonBinary . def () , Self :: Options => ColumnType :: JsonBinary . def () , } } } - -impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/store_currencies.rs b/crates/model/src/v4/store_currencies.rs index f008d89..6dd99ac 100644 --- a/crates/model/src/v4/store_currencies.rs +++ b/crates/model/src/v4/store_currencies.rs @@ -1,29 +1,83 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "store_currencies" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub store_id: String, + pub currency_code: String, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "store_currencies" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + StoreId, + CurrencyCode, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub store_id : String , pub currency_code : String , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + StoreId, + CurrencyCode, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { StoreId , CurrencyCode , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = (String, String); + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { StoreId , CurrencyCode , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Currencies, + Stores, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::StoreId => ColumnType::String(None).def(), + Self::CurrencyCode => ColumnType::String(None).def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Currencies , Stores , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Currencies => Entity::belongs_to(super::currencies::Entity) + .from(Column::CurrencyCode) + .to(super::currencies::Column::Code) + .into(), + Self::Stores => Entity::belongs_to(super::stores::Entity) + .from(Column::StoreId) + .to(super::stores::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: StoreId => ColumnType :: String (None) . def () , Self :: CurrencyCode => ColumnType :: String (None) . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Currencies.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Currencies => Entity :: belongs_to (super :: currencies :: Entity) . from (Column :: CurrencyCode) . to (super :: currencies :: Column :: Code) . into () , Self :: Stores => Entity :: belongs_to (super :: stores :: Entity) . from (Column :: StoreId) . to (super :: stores :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Stores.def() + } +} -impl Related < super :: currencies :: Entity > for Entity { fn to () -> RelationDef { Relation :: Currencies . def () } } - -impl Related < super :: stores :: Entity > for Entity { fn to () -> RelationDef { Relation :: Stores . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/stores.rs b/crates/model/src/v4/stores.rs index f3c25c2..4129ef5 100644 --- a/crates/model/src/v4/stores.rs +++ b/crates/model/src/v4/stores.rs @@ -1,29 +1,112 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "stores" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub name: String, + pub default_currency_code: String, + pub swap_link_template: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, + pub payment_link_template: Option, + pub invite_link_template: Option, + pub default_sales_channel_id: Option, + pub default_location_id: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "stores" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Name, + DefaultCurrencyCode, + SwapLinkTemplate, + CreatedAt, + UpdatedAt, + Metadata, + PaymentLinkTemplate, + InviteLinkTemplate, + DefaultSalesChannelId, + DefaultLocationId, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub name : String , pub default_currency_code : String , pub swap_link_template : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , pub payment_link_template : Option < String > , pub invite_link_template : Option < String > , pub default_sales_channel_id : Option < String > , pub default_location_id : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Name , DefaultCurrencyCode , SwapLinkTemplate , CreatedAt , UpdatedAt , Metadata , PaymentLinkTemplate , InviteLinkTemplate , DefaultSalesChannelId , DefaultLocationId , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Currencies, + SalesChannels, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Name => ColumnType::String(None).def(), + Self::DefaultCurrencyCode => ColumnType::String(None).def(), + Self::SwapLinkTemplate => ColumnType::String(None).def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::PaymentLinkTemplate => ColumnType::String(None).def().null(), + Self::InviteLinkTemplate => ColumnType::String(None).def().null(), + Self::DefaultSalesChannelId => ColumnType::String(None).def().null().unique(), + Self::DefaultLocationId => ColumnType::String(None).def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Currencies , SalesChannels , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Currencies => Entity::belongs_to(super::currencies::Entity) + .from(Column::DefaultCurrencyCode) + .to(super::currencies::Column::Code) + .into(), + Self::SalesChannels => Entity::belongs_to(super::sales_channels::Entity) + .from(Column::DefaultSalesChannelId) + .to(super::sales_channels::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Name => ColumnType :: String (None) . def () , Self :: DefaultCurrencyCode => ColumnType :: String (None) . def () , Self :: SwapLinkTemplate => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: PaymentLinkTemplate => ColumnType :: String (None) . def () . null () , Self :: InviteLinkTemplate => ColumnType :: String (None) . def () . null () , Self :: DefaultSalesChannelId => ColumnType :: String (None) . def () . null () . unique () , Self :: DefaultLocationId => ColumnType :: String (None) . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::SalesChannels.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Currencies => Entity :: belongs_to (super :: currencies :: Entity) . from (Column :: DefaultCurrencyCode) . to (super :: currencies :: Column :: Code) . into () , Self :: SalesChannels => Entity :: belongs_to (super :: sales_channels :: Entity) . from (Column :: DefaultSalesChannelId) . to (super :: sales_channels :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + super::store_currencies::Relation::Currencies.def() + } + fn via() -> Option { + Some(super::store_currencies::Relation::Stores.def().rev()) + } +} -impl Related < super :: sales_channels :: Entity > for Entity { fn to () -> RelationDef { Relation :: SalesChannels . def () } } - -impl Related < super :: currencies :: Entity > for Entity { fn to () -> RelationDef { super :: store_currencies :: Relation :: Currencies . def () } fn via () -> Option < RelationDef > { Some (super :: store_currencies :: Relation :: Stores . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/swaps.rs b/crates/model/src/v4/swaps.rs index be9a05a..a6ef908 100644 --- a/crates/model/src/v4/swaps.rs +++ b/crates/model/src/v4/swaps.rs @@ -1,41 +1,177 @@ //! `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::{SwapFulfillmentStatuses, SwapPaymentStatuses}; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: SwapFulfillmentStatuses ; use super :: sea_orm_active_enums :: SwapPaymentStatuses ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "swaps" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "swaps" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub fulfillment_status: SwapFulfillmentStatuses, + pub payment_status: SwapPaymentStatuses, + pub order_id: String, + pub difference_due: Option, + pub shipping_address_id: Option, + pub cart_id: Option, + pub confirmed_at: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub idempotency_key: Option, + pub no_notification: Option, + pub canceled_at: Option, + pub allow_backorder: bool, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub fulfillment_status : SwapFulfillmentStatuses , pub payment_status : SwapPaymentStatuses , pub order_id : String , pub difference_due : Option < i32 > , pub shipping_address_id : Option < String > , pub cart_id : Option < String > , pub confirmed_at : Option < DateTimeWithTimeZone > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub idempotency_key : Option < String > , pub no_notification : Option < bool > , pub canceled_at : Option < DateTimeWithTimeZone > , pub allow_backorder : bool , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + FulfillmentStatus, + PaymentStatus, + OrderId, + DifferenceDue, + ShippingAddressId, + CartId, + ConfirmedAt, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + IdempotencyKey, + NoNotification, + CanceledAt, + AllowBackorder, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , FulfillmentStatus , PaymentStatus , OrderId , DifferenceDue , ShippingAddressId , CartId , ConfirmedAt , CreatedAt , UpdatedAt , DeletedAt , Metadata , IdempotencyKey , NoNotification , CanceledAt , AllowBackorder , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Addresses, + Carts, + Fulfillments, + LineItems, + Orders, + Payments, + Returns, + ShippingMethods, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Addresses , Carts , Fulfillments , LineItems , Orders , Payments , Returns , ShippingMethods , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::FulfillmentStatus => SwapFulfillmentStatuses::db_type().def(), + Self::PaymentStatus => SwapPaymentStatuses::db_type().def(), + Self::OrderId => ColumnType::String(None).def(), + Self::DifferenceDue => ColumnType::Integer.def().null(), + Self::ShippingAddressId => ColumnType::String(None).def().null(), + Self::CartId => ColumnType::String(None).def().null().unique(), + Self::ConfirmedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::IdempotencyKey => ColumnType::String(None).def().null(), + Self::NoNotification => ColumnType::Boolean.def().null(), + Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::AllowBackorder => ColumnType::Boolean.def(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: FulfillmentStatus => SwapFulfillmentStatuses :: db_type () . def () , Self :: PaymentStatus => SwapPaymentStatuses :: db_type () . def () , Self :: OrderId => ColumnType :: String (None) . def () , Self :: DifferenceDue => ColumnType :: Integer . def () . null () , Self :: ShippingAddressId => ColumnType :: String (None) . def () . null () , Self :: CartId => ColumnType :: String (None) . def () . null () . unique () , Self :: ConfirmedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: IdempotencyKey => ColumnType :: String (None) . def () . null () , Self :: NoNotification => ColumnType :: Boolean . def () . null () , Self :: CanceledAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: AllowBackorder => ColumnType :: Boolean . def () , } } } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Addresses => Entity::belongs_to(super::addresses::Entity) + .from(Column::ShippingAddressId) + .to(super::addresses::Column::Id) + .into(), + Self::Carts => Entity::belongs_to(super::carts::Entity) + .from(Column::CartId) + .to(super::carts::Column::Id) + .into(), + Self::Fulfillments => Entity::has_many(super::fulfillments::Entity).into(), + Self::LineItems => Entity::has_many(super::line_items::Entity).into(), + Self::Orders => Entity::belongs_to(super::orders::Entity) + .from(Column::OrderId) + .to(super::orders::Column::Id) + .into(), + Self::Payments => Entity::has_one(super::payments::Entity).into(), + Self::Returns => Entity::has_one(super::returns::Entity).into(), + Self::ShippingMethods => Entity::has_many(super::shipping_methods::Entity).into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Addresses => Entity :: belongs_to (super :: addresses :: Entity) . from (Column :: ShippingAddressId) . to (super :: addresses :: Column :: Id) . into () , Self :: Carts => Entity :: belongs_to (super :: carts :: Entity) . from (Column :: CartId) . to (super :: carts :: Column :: Id) . into () , Self :: Fulfillments => Entity :: has_many (super :: fulfillments :: Entity) . into () , Self :: LineItems => Entity :: has_many (super :: line_items :: Entity) . into () , Self :: Orders => Entity :: belongs_to (super :: orders :: Entity) . from (Column :: OrderId) . to (super :: orders :: Column :: Id) . into () , Self :: Payments => Entity :: has_one (super :: payments :: Entity) . into () , Self :: Returns => Entity :: has_one (super :: returns :: Entity) . into () , Self :: ShippingMethods => Entity :: has_many (super :: shipping_methods :: Entity) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Addresses.def() + } +} -impl Related < super :: addresses :: Entity > for Entity { fn to () -> RelationDef { Relation :: Addresses . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Carts.def() + } +} -impl Related < super :: carts :: Entity > for Entity { fn to () -> RelationDef { Relation :: Carts . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Fulfillments.def() + } +} -impl Related < super :: fulfillments :: Entity > for Entity { fn to () -> RelationDef { Relation :: Fulfillments . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::LineItems.def() + } +} -impl Related < super :: line_items :: Entity > for Entity { fn to () -> RelationDef { Relation :: LineItems . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Orders.def() + } +} -impl Related < super :: orders :: Entity > for Entity { fn to () -> RelationDef { Relation :: Orders . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Payments.def() + } +} -impl Related < super :: payments :: Entity > for Entity { fn to () -> RelationDef { Relation :: Payments . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Returns.def() + } +} -impl Related < super :: returns :: Entity > for Entity { fn to () -> RelationDef { Relation :: Returns . def () } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::ShippingMethods.def() + } +} -impl Related < super :: shipping_methods :: Entity > for Entity { fn to () -> RelationDef { Relation :: ShippingMethods . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/tax_providers.rs b/crates/model/src/v4/tax_providers.rs index 2cdc479..8be61c4 100644 --- a/crates/model/src/v4/tax_providers.rs +++ b/crates/model/src/v4/tax_providers.rs @@ -1,27 +1,68 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "tax_providers" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub is_installed: bool, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "tax_providers" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + IsInstalled, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub is_installed : bool , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , IsInstalled , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Regions, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::IsInstalled => ColumnType::Boolean.def(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Regions , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Regions => Entity::has_many(super::regions::Entity).into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: IsInstalled => ColumnType :: Boolean . def () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Regions.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Regions => Entity :: has_many (super :: regions :: Entity) . into () , } } } - -impl Related < super :: regions :: Entity > for Entity { fn to () -> RelationDef { Relation :: Regions . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/tax_rates.rs b/crates/model/src/v4/tax_rates.rs index b66ab60..bc650d1 100644 --- a/crates/model/src/v4/tax_rates.rs +++ b/crates/model/src/v4/tax_rates.rs @@ -1,33 +1,120 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "tax_rates" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub rate: Option, + pub code: Option, + pub name: String, + pub region_id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub metadata: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "tax_rates" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Rate, + Code, + Name, + RegionId, + CreatedAt, + UpdatedAt, + Metadata, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Serialize , Deserialize)] pub struct Model { pub id : String , pub rate : Option < f32 > , pub code : Option < String > , pub name : String , pub region_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Rate , Code , Name , RegionId , CreatedAt , UpdatedAt , Metadata , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Regions, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Rate => ColumnType::Float.def().null(), + Self::Code => ColumnType::String(None).def().null(), + Self::Name => ColumnType::String(None).def(), + Self::RegionId => ColumnType::String(None).def(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Regions , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Regions => Entity::belongs_to(super::regions::Entity) + .from(Column::RegionId) + .to(super::regions::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Rate => ColumnType :: Float . def () . null () , Self :: Code => ColumnType :: String (None) . def () . null () , Self :: Name => ColumnType :: String (None) . def () , Self :: RegionId => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Regions.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Regions => Entity :: belongs_to (super :: regions :: Entity) . from (Column :: RegionId) . to (super :: regions :: Column :: Id) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_tax_rates::Relation::Products.def() + } + fn via() -> Option { + Some(super::product_tax_rates::Relation::TaxRates.def().rev()) + } +} -impl Related < super :: regions :: Entity > for Entity { fn to () -> RelationDef { Relation :: Regions . def () } } +impl Related for Entity { + fn to() -> RelationDef { + super::product_type_tax_rates::Relation::ProductTypes.def() + } + fn via() -> Option { + Some( + super::product_type_tax_rates::Relation::TaxRates + .def() + .rev(), + ) + } +} -impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { super :: product_tax_rates :: Relation :: Products . def () } fn via () -> Option < RelationDef > { Some (super :: product_tax_rates :: Relation :: TaxRates . def () . rev ()) } } +impl Related for Entity { + fn to() -> RelationDef { + super::shipping_tax_rates::Relation::ShippingOptions.def() + } + fn via() -> Option { + Some(super::shipping_tax_rates::Relation::TaxRates.def().rev()) + } +} -impl Related < super :: product_types :: Entity > for Entity { fn to () -> RelationDef { super :: product_type_tax_rates :: Relation :: ProductTypes . def () } fn via () -> Option < RelationDef > { Some (super :: product_type_tax_rates :: Relation :: TaxRates . def () . rev ()) } } - -impl Related < super :: shipping_options :: Entity > for Entity { fn to () -> RelationDef { super :: shipping_tax_rates :: Relation :: ShippingOptions . def () } fn via () -> Option < RelationDef > { Some (super :: shipping_tax_rates :: Relation :: TaxRates . def () . rev ()) } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/tracking_links.rs b/crates/model/src/v4/tracking_links.rs index 46e1821..ef6529a 100644 --- a/crates/model/src/v4/tracking_links.rs +++ b/crates/model/src/v4/tracking_links.rs @@ -1,27 +1,92 @@ //! `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; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "tracking_links" + } +} -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub url: Option, + pub tracking_number: String, + pub fulfillment_id: String, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub idempotency_key: Option, +} -impl EntityName for Entity { fn table_name (& self) -> & str { "tracking_links" } } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Url, + TrackingNumber, + FulfillmentId, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + IdempotencyKey, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub url : Option < String > , pub tracking_number : String , pub fulfillment_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub idempotency_key : Option < String > , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Url , TrackingNumber , FulfillmentId , CreatedAt , UpdatedAt , DeletedAt , Metadata , IdempotencyKey , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + Fulfillments, +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Url => ColumnType::String(None).def().null(), + Self::TrackingNumber => ColumnType::String(None).def(), + Self::FulfillmentId => 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(), + Self::IdempotencyKey => ColumnType::String(None).def().null(), + } + } +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Fulfillments , } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::Fulfillments => Entity::belongs_to(super::fulfillments::Entity) + .from(Column::FulfillmentId) + .to(super::fulfillments::Column::Id) + .into(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Url => ColumnType :: String (None) . def () . null () , Self :: TrackingNumber => ColumnType :: String (None) . def () , Self :: FulfillmentId => 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 () , Self :: IdempotencyKey => ColumnType :: String (None) . def () . null () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::Fulfillments.def() + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Fulfillments => Entity :: belongs_to (super :: fulfillments :: Entity) . from (Column :: FulfillmentId) . to (super :: fulfillments :: Column :: Id) . into () , } } } - -impl Related < super :: fulfillments :: Entity > for Entity { fn to () -> RelationDef { Relation :: Fulfillments . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/crates/model/src/v4/users.rs b/crates/model/src/v4/users.rs index fca67e5..aeec8e8 100644 --- a/crates/model/src/v4/users.rs +++ b/crates/model/src/v4/users.rs @@ -1,27 +1,97 @@ //! `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::UserRoles; -use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ; use super :: sea_orm_active_enums :: UserRoles ; +#[derive(Copy, Clone, Default, Debug, DeriveEntity)] +pub struct Entity; -# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ; +impl EntityName for Entity { + fn table_name(&self) -> &str { + "users" + } +} -impl EntityName for Entity { fn table_name (& self) -> & str { "users" } } +#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)] +pub struct Model { + pub id: String, + pub email: String, + pub first_name: Option, + pub last_name: Option, + pub password_hash: Option, + pub api_token: Option, + pub created_at: DateTimeWithTimeZone, + pub updated_at: DateTimeWithTimeZone, + pub deleted_at: Option, + pub metadata: Option, + pub role: Option, +} -# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub email : String , pub first_name : Option < String > , pub last_name : Option < String > , pub password_hash : Option < String > , pub api_token : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub role : Option < UserRoles > , } +#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)] +pub enum Column { + Id, + Email, + FirstName, + LastName, + PasswordHash, + ApiToken, + CreatedAt, + UpdatedAt, + DeletedAt, + Metadata, + Role, +} -# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Email , FirstName , LastName , PasswordHash , ApiToken , CreatedAt , UpdatedAt , DeletedAt , Metadata , Role , } +#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)] +pub enum PrimaryKey { + Id, +} -# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , } +impl PrimaryKeyTrait for PrimaryKey { + type ValueType = String; + fn auto_increment() -> bool { + false + } +} -impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } } +#[derive(Copy, Clone, Debug, EnumIter)] +pub enum Relation { + BatchJobs, +} -# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { BatchJobs , } +impl ColumnTrait for Column { + type EntityName = Entity; + fn def(&self) -> ColumnDef { + match self { + Self::Id => ColumnType::String(None).def(), + Self::Email => ColumnType::String(None).def(), + Self::FirstName => ColumnType::String(None).def().null(), + Self::LastName => ColumnType::String(None).def().null(), + Self::PasswordHash => ColumnType::String(None).def().null(), + Self::ApiToken => ColumnType::String(None).def().null(), + Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(), + Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(), + Self::Metadata => ColumnType::JsonBinary.def().null(), + Self::Role => UserRoles::db_type().def().null(), + } + } +} -impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Email => ColumnType :: String (None) . def () , Self :: FirstName => ColumnType :: String (None) . def () . null () , Self :: LastName => ColumnType :: String (None) . def () . null () , Self :: PasswordHash => ColumnType :: String (None) . def () . null () , Self :: ApiToken => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: Role => UserRoles :: db_type () . def () . null () , } } } +impl RelationTrait for Relation { + fn def(&self) -> RelationDef { + match self { + Self::BatchJobs => Entity::has_many(super::batch_jobs::Entity).into(), + } + } +} -impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: BatchJobs => Entity :: has_many (super :: batch_jobs :: Entity) . into () , } } } +impl Related for Entity { + fn to() -> RelationDef { + Relation::BatchJobs.def() + } +} -impl Related < super :: batch_jobs :: Entity > for Entity { fn to () -> RelationDef { Relation :: BatchJobs . def () } } - -impl ActiveModelBehavior for ActiveModel { } \ No newline at end of file +impl ActiveModelBehavior for ActiveModel {} diff --git a/migration/src/checkouts/m20230603_120815_items.rs b/migration/src/checkouts/m20230603_120815_items.rs index 1ad0871..2c82b05 100644 --- a/migration/src/checkouts/m20230603_120815_items.rs +++ b/migration/src/checkouts/m20230603_120815_items.rs @@ -99,16 +99,17 @@ impl Migration { m.create_constraint( LineItems, Check::less_eq(ShippedQuantity, FulfilledQuantity), + None, ) .await?; - m.create_constraint(LineItems, Check::greater(Quantity, 0.iden())) + m.create_constraint(LineItems, Check::greater(Quantity, 0.iden()), None) .await?; - m.create_constraint(LineItems, Check::less_eq(ReturnedQuantity, Quantity)) + m.create_constraint(LineItems, Check::less_eq(ReturnedQuantity, Quantity), None) .await?; - m.create_constraint(LineItems, Check::less_eq(FulfilledQuantity, Quantity)) + m.create_constraint(LineItems, Check::less_eq(FulfilledQuantity, Quantity), None) .await?; Ok(()) diff --git a/migration/src/sea_ext/mod.rs b/migration/src/sea_ext/mod.rs index 16639aa..cdaf75d 100644 --- a/migration/src/sea_ext/mod.rs +++ b/migration/src/sea_ext/mod.rs @@ -253,7 +253,12 @@ impl Display for Constraint { #[async_trait] pub trait CreateConstraint { - async fn create_constraint(&self, table: T, c: C) -> Result<(), DbErr> + async fn create_constraint( + &self, + table: T, + c: C, + name: Option, + ) -> Result<(), DbErr> where T: Iden + Send, C: Into + Send; @@ -261,7 +266,12 @@ pub trait CreateConstraint { #[async_trait] impl CreateConstraint for SchemaManager<'_> { - async fn create_constraint(&self, table: T, c: C) -> Result<(), DbErr> + async fn create_constraint( + &self, + table: T, + c: C, + name: Option, + ) -> Result<(), DbErr> where T: Iden + Send, C: Into + Send, @@ -271,7 +281,7 @@ impl CreateConstraint for SchemaManager<'_> { .execute_unprepared(&format!( "ALTER TABLE {} ADD CONSTRAINT {} {}", table.to_string(), - c.to_name(), + name.unwrap_or_else(|| c.to_name()), c )) .await?; @@ -288,15 +298,10 @@ mod tests { #[derive(Iden)] pub enum ShippingMethod { - ShippingMethods, - Id, - ShippingOptionId, OrderId, CartId, SwapId, ReturnId, - Price, - Data, ClaimOrderId, } diff --git a/migration/src/shipping/m20230603_120810_shipping.rs b/migration/src/shipping/m20230603_120810_shipping.rs index 8fc1786..9cb7c84 100644 --- a/migration/src/shipping/m20230603_120810_shipping.rs +++ b/migration/src/shipping/m20230603_120810_shipping.rs @@ -1,8 +1,10 @@ use sea_orm_migration::prelude::*; use crate::constraint::Check; +use crate::sea_orm::Iterable; use crate::{ - auto_uuid_not_null, ts_def_now_not_null, AsIden, CreateConstraint, DropTable, IntoColumnDef, + auto_uuid_not_null, ts_def_now_not_null, AsIden, CreateConstraint, CreateIndexExt, DropTable, + IntoColumnDef, }; #[derive(DeriveMigrationName)] @@ -48,18 +50,20 @@ impl Migration { /// ); /// ``` async fn create_tracking_links(m: &SchemaManager<'_>) -> Result<(), DbErr> { + use TrackingLink::*; + m.create_table( Table::create() - .table(TrackingLink::TrackingLinks) - .col(auto_uuid_not_null!(TrackingLink::Id)) - .col(TrackingLink::Url.col().string()) - .col(TrackingLink::TrackingNumber.col().string().not_null()) - .col(TrackingLink::FulfillmentId.col().uuid().not_null()) - .col(ts_def_now_not_null!(TrackingLink::CreatedAt)) - .col(ts_def_now_not_null!(TrackingLink::UpdatedAt)) - .col(TrackingLink::DeletedAt.col().timestamp()) - .col(TrackingLink::Metadata.col().json_binary()) - .col(TrackingLink::IdempotencyKey.col().uuid()) + .table(TrackingLinks) + .col(auto_uuid_not_null!(Id)) + .col(Url.col().string()) + .col(TrackingNumber.col().string().not_null()) + .col(FulfillmentId.col().uuid().not_null()) + .col(ts_def_now_not_null!(CreatedAt)) + .col(ts_def_now_not_null!(UpdatedAt)) + .col(DeletedAt.col().timestamp()) + .col(Metadata.col().json_binary()) + .col(IdempotencyKey.col().uuid()) .to_owned(), ) .await?; @@ -80,30 +84,25 @@ impl Migration { /// ); /// ``` async fn create_custom_shipping_options(m: &SchemaManager<'_>) -> Result<(), DbErr> { + use CustomShippingOption::*; + m.create_table( Table::create() - .table(CustomShippingOption::CustomShippingOptions) - .col(auto_uuid_not_null!(CustomShippingOption::Id)) - .col(CustomShippingOption::Price.col().integer().not_null()) - .col( - CustomShippingOption::ShippingOptionId - .col() - .uuid() - .not_null(), - ) - .col(CustomShippingOption::CartId.col().uuid().not_null()) - .col(ts_def_now_not_null!(CustomShippingOption::CreatedAt)) - .col(ts_def_now_not_null!(CustomShippingOption::UpdatedAt)) - .col(CustomShippingOption::DeletedAt.col().timestamp()) - .col(CustomShippingOption::Metadata.col().json_binary()) + .table(CustomShippingOptions) + .col(auto_uuid_not_null!(Id)) + .col(Price.col().integer().not_null()) + .col(ShippingOptionId.col().uuid().not_null()) + .col(CartId.col().uuid().not_null()) + .col(ts_def_now_not_null!(CreatedAt)) + .col(ts_def_now_not_null!(UpdatedAt)) + .col(DeletedAt.col().timestamp()) + .col(Metadata.col().json_binary()) .to_owned(), ) .await?; Ok(()) } - //########################################### - /// ```sql /// CREATE TABLE shipping_methods /// ( @@ -129,19 +128,35 @@ impl Migration { /// ); /// ``` async fn create_shipping_methods(m: &SchemaManager<'_>) -> Result<(), DbErr> { - m.create_constraint( - ShippingMethod::ShippingMethods, - Check::greater_eq(ShippingMethod::Price, 0.iden()), + use ShippingMethod::*; + + m.create_table( + Table::create() + .table(ShippingMethods) + .col(auto_uuid_not_null!(Id)) + .col(ShippingOptionId.col().uuid().not_null()) + .col(OrderId.col().uuid()) + .col(CartId.col().uuid()) + .col(SwapId.col().uuid()) + .col(ReturnId.col().uuid()) + .col(Price.col().integer().not_null()) + .col(Data.col().json_binary().not_null()) + .col(ClaimOrderId.col().uuid()) + .to_owned(), ) .await?; + m.create_constraint(ShippingMethods, Check::greater_eq(Price, 0.iden()), None) + .await?; + m.create_constraint( - ShippingMethod::ShippingMethods, - Check::not_null(ShippingMethod::ClaimOrderId) - | Check::not_null(ShippingMethod::OrderId) - | Check::not_null(ShippingMethod::CartId) - | Check::not_null(ShippingMethod::SwapId) - | Check::not_null(ShippingMethod::ReturnId), + ShippingMethods, + Check::not_null(ClaimOrderId) + | Check::not_null(OrderId) + | Check::not_null(CartId) + | Check::not_null(SwapId) + | Check::not_null(ReturnId), + None, ) .await?; Ok(()) @@ -161,6 +176,23 @@ impl Migration { /// ); /// ``` async fn create_shipping_method_tax_lines(m: &SchemaManager<'_>) -> Result<(), DbErr> { + use ShippingMethodTaxLine::*; + + m.create_table( + Table::create() + .table(ShippingMethodTaxLines) + .col(auto_uuid_not_null!(Id)) + .col(Rate.col().double().not_null()) + .col(Name.col().string().not_null()) + .col(Code.col().string()) + .col(ts_def_now_not_null!(CreatedAt)) + .col(ts_def_now_not_null!(UpdatedAt)) + .col(Metadata.col().json_binary()) + .col(ShippingMethodId.col().uuid().not_null()) + .to_owned(), + ) + .await?; + Ok(()) } @@ -185,11 +217,40 @@ impl Migration { /// ); /// ```` async fn create_shipping_options(m: &SchemaManager<'_>) -> Result<(), DbErr> { - m.create_constraint( - ShippingOption::ShippingOptions, - Check::greater_eq(ShippingOption::Amount, 0.iden()), + use ShippingOption::*; + + m.create_table( + Table::create() + .table(ShippingOptions) + .col(auto_uuid_not_null!(Id)) + .col(Name.col().string().not_null()) + .col(RegionId.col().uuid().not_null()) + .col(ProfileId.col().uuid().not_null()) + .col(ProviderId.col().uuid().not_null()) + .col( + PriceType + .col() + .enumeration( + crate::types::ShippingOptionPriceType::ShippingOptionPriceTypes, + crate::types::ShippingOptionPriceType::iter().skip(1), + ) + .not_null(), + ) + .col(Amount.col().integer()) + .col(IsReturn.col().boolean().default(false).not_null()) + .col(Data.col().json_binary().not_null()) + .col(ts_def_now_not_null!(CreatedAt)) + .col(ts_def_now_not_null!(UpdatedAt)) + .col(DeletedAt.col().timestamp()) + .col(Metadata.col().json_binary()) + .col(AdminOnly.col().boolean().default(false).not_null()) + .to_owned(), ) .await?; + + m.create_constraint(ShippingOptions, Check::greater_eq(Amount, 0.iden()), None) + .await?; + Ok(()) } @@ -204,6 +265,28 @@ impl Migration { /// ); /// ``` async fn create_shipping_option_requirements(m: &SchemaManager<'_>) -> Result<(), DbErr> { + use ShippingOptionRequirement::*; + + m.create_table( + Table::create() + .table(ShippingOptionRequirements) + .col(auto_uuid_not_null!(Id)) + .col(ShippingOptionId.col().uuid().not_null()) + .col( + ShippingOptionRequirementType + .col() + .enumeration( + crate::types::ShippingOptionRequirementType::ShippingOptionRequirementTypes, + crate::types::ShippingOptionRequirementType::iter().skip(1) + ) + .not_null(), + ) + .col(Amount.col().integer().not_null()) + .col(DeletedAt.col().timestamp()) + .to_owned(), + ) + .await?; + Ok(()) } @@ -220,6 +303,30 @@ impl Migration { /// ); /// ``` async fn create_shipping_profiles(m: &SchemaManager<'_>) -> Result<(), DbErr> { + use ShippingProfile::*; + + m.create_table( + Table::create() + .table(ShippingProfiles) + .col(auto_uuid_not_null!(Id)) + .col(Name.col().string().not_null()) + .col( + ShippingProfileType + .col() + .enumeration( + crate::types::ShippingProfileType::ShippingProfileTypes, + crate::types::ShippingProfileType::iter().skip(1), + ) + .not_null(), + ) + .col(ts_def_now_not_null!(CreatedAt)) + .col(ts_def_now_not_null!(UpdatedAt)) + .col(DeletedAt.col().timestamp()) + .col(Metadata.col().json_binary()) + .to_owned(), + ) + .await?; + Ok(()) } @@ -234,6 +341,23 @@ impl Migration { /// ); /// ``` async fn create_shipping_tax_rates(m: &SchemaManager<'_>) -> Result<(), DbErr> { + use ShippingTaxRate::*; + + m.create_table( + Table::create() + .table(ShippingTaxRates) + .col(ShippingOptionId.col().uuid().not_null()) + .col(RateId.col().uuid().not_null()) + .col(ts_def_now_not_null!(CreatedAt)) + .col(ts_def_now_not_null!(UpdatedAt)) + .col(Metadata.col().json_binary()) + .to_owned(), + ) + .await?; + + m.create_2col_idx(ShippingTaxRates, ShippingOptionId, RateId) + .await?; + Ok(()) } } @@ -265,8 +389,6 @@ pub enum CustomShippingOption { Metadata, } -//############################# - #[derive(Iden)] pub enum ShippingMethod { ShippingMethods, @@ -329,7 +451,14 @@ pub enum ShippingProfile { Id, Name, ShippingProfileType, + CreatedAt, + UpdatedAt, DeletedAt, + Metadata, +} + +#[derive(Iden, Copy, Clone)] +pub enum ShippingTaxRate { ShippingTaxRates, ShippingOptionId, RateId,