item_models 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2093ffd195104bfddd2d79661d2e61a987f29046c52049633541c0fe19e6a0e5
4
- data.tar.gz: 1e6f5a1c3d04f65ef36186e7ebc8cab503a79a0fa476680a927e000499e8c94c
3
+ metadata.gz: d872a325665c20b099296417ca9dc897438119060e8a7afdfba68af020ad42cf
4
+ data.tar.gz: 98d4410bda21cf5bec2e2064dabe9c5b290c518140105b6b26fa837b17bf9211
5
5
  SHA512:
6
- metadata.gz: 4dd4928eaaa427901f61e18c0f5ece615511f088b53ee5e563f17e47c65fa2517ef86e3b6e993b062bc4e038e35eee782ec0c152a8400ff59a71a2f5c6b2a64a
7
- data.tar.gz: 649f591532485d598e0d0c4b1162b92e75ea3cfa1bd175d076c0bb5e12e148ffda801f348281fe06c8700d595bed5fc5b66f710ae2f35b7ec08343021a27aec0
6
+ metadata.gz: 6e352df5cebe787d50cee89fd1b9fbfbc469182ad884827f4c828de9240c03baabc3565dcee5ba7f53e55f9d488f8c44ef7955026974de5ca71d4fa85cd8d27e
7
+ data.tar.gz: 8290b73f9aad00ee65f029138c7087f341e8402f841011ce77ff558856e62f19fce841a5577741149633625a0307b3c5b99822372becfe79e14f87b8ff664bda
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ItemModels
4
- VERSION = '0.0.17'
4
+ VERSION = '0.0.18'
5
5
  end
data/lib/models/item.rb CHANGED
@@ -8,6 +8,7 @@ class Item < ItemApplicationRecord
8
8
  has_many :item_listings
9
9
  has_many :bundles
10
10
  has_many :images
11
+ has_many :option_types, foreign_key: :item_id
11
12
 
12
13
  def assign_from_profile(profile)
13
14
  self.profile_id = profile.id
@@ -10,4 +10,8 @@ class ItemListingBrand < ItemApplicationRecord
10
10
  class_name: 'ShopeeBrand',
11
11
  foreign_key: :shopee_brand_id,
12
12
  optional: true
13
+ belongs_to :tokopedia,
14
+ class_name: 'ShopeeBrand',
15
+ foreign_key: :shopee_brand_id,
16
+ optional: true
13
17
  end
@@ -10,4 +10,8 @@ class ItemListingCategory < ItemApplicationRecord
10
10
  class_name: 'ShopeeCategory',
11
11
  foreign_key: :shopee_category_id,
12
12
  optional: true
13
+ belongs_to :tokopedia,
14
+ class_name: 'TokopediaCategory',
15
+ foreign_key: :tokopedia_category_id,
16
+ optional: true
13
17
  end
@@ -10,4 +10,8 @@ class ItemListingVariantCustomField < ItemApplicationRecord
10
10
  class_name: 'ShopeeItemVariantCustomField',
11
11
  foreign_key: :shopee_item_variant_custom_field_id,
12
12
  optional: true
13
+ belongs_to :tokopedia,
14
+ class_name: 'TokopediaItemVariantCustomField',
15
+ foreign_key: :tokopedia_custom_field_id,
16
+ optional: true
13
17
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class OptionType < ItemApplicationRecord
4
+ self.table_name = 'item_variant_option_types'
5
+
6
+ belongs_to :item
7
+ has_many :options, class_name: 'VariantOption', foreign_key: :option_type_id
8
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TokopediaCategory < ItemApplicationRecord
4
+ self.table_name = 'channel_tokopedia_categories'
5
+
6
+ belongs_to :parent_category,
7
+ class_name: 'TokopediaCategory',
8
+ foreign_key: :parent_category_id,
9
+ optional: true
10
+ belongs_to :primary_category,
11
+ class_name: 'TokopediaCategory',
12
+ foreign_key: :primary_category_id,
13
+ optional: true
14
+ has_many :child_categories,
15
+ class_name: 'TokopediaCategory',
16
+ foreign_key: :parent_category_id,
17
+ dependent: :destroy
18
+
19
+ has_many :item_channel_association_categories,
20
+ class_name: '::ItemListingCategory',
21
+ foreign_key: :tokopedia_category_id
22
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TokopediaItemVariantCustomField < ItemApplicationRecord
4
+ self.table_name = 'channel_tokopedia_item_variant_custom_fields'
5
+ end
@@ -13,6 +13,8 @@ class Variant < ItemApplicationRecord
13
13
  has_many :item_listing_variant_custom_field, foreign_key: :variant_id
14
14
  has_many :item_listing_custom_field, foreign_key: :variant_id
15
15
  has_one :master_catalog, foreign_key: :variant_id
16
+ has_many :option_associations, class_name: 'VariantOptionAssociation', foreign_key: :variant_id
17
+ has_many :options, through: :option_associations, source: :variant_option
16
18
 
17
19
  def assign_from_item(item)
18
20
  self.item_id = item.id
@@ -6,4 +6,6 @@ class VariantOptionAssociation < ItemApplicationRecord
6
6
  include ::Restorable
7
7
 
8
8
  belongs_to :variant_option, foreign_key: :option_id
9
+ belongs_to :variant, foreign_key: :variant_id
10
+ belongs_to :option_type, foreign_key: :option_type_id
9
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: item_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexander
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-20 00:00:00.000000000 Z
11
+ date: 2022-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ files:
78
78
  - lib/models/item_listing_variant_image.rb
79
79
  - lib/models/master_catalog.rb
80
80
  - lib/models/master_catalog_image.rb
81
+ - lib/models/option_type.rb
81
82
  - lib/models/shopee_brand.rb
82
83
  - lib/models/shopee_category.rb
83
84
  - lib/models/shopee_item_custom_field.rb
@@ -85,6 +86,8 @@ files:
85
86
  - lib/models/shopee_item_variant_custom_field.rb
86
87
  - lib/models/shopee_logistic_address.rb
87
88
  - lib/models/shopee_shipping_provider.rb
89
+ - lib/models/tokopedia_category.rb
90
+ - lib/models/tokopedia_item_variant_custom_field.rb
88
91
  - lib/models/variant.rb
89
92
  - lib/models/variant_image.rb
90
93
  - lib/models/variant_listing.rb