item_models 0.0.9 → 0.0.14
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 +4 -4
- data/lib/item_models/version.rb +1 -1
- data/lib/models/activity.rb +1 -1
- data/lib/models/availability_option.rb +1 -1
- data/lib/models/bundle.rb +3 -1
- data/lib/models/bundle_variant.rb +2 -0
- data/lib/models/concerns/restorable.rb +28 -0
- data/lib/models/image.rb +2 -0
- data/lib/models/item.rb +3 -0
- data/lib/models/item_application_record.rb +1 -1
- data/lib/models/item_listing.rb +6 -0
- data/lib/models/item_listing_brand.rb +2 -0
- data/lib/models/item_listing_category.rb +2 -0
- data/lib/models/item_listing_custom_field.rb +2 -0
- data/lib/models/item_listing_image.rb +3 -0
- data/lib/models/variant.rb +3 -0
- data/lib/models/variant_image.rb +2 -0
- data/lib/models/variant_listing.rb +6 -2
- data/lib/models/variant_option.rb +2 -0
- data/lib/models/variant_option_association.rb +2 -0
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9347bfc3533841aa69d769771e76642b479c1d2785be5b0a2d3564ac201414fa
|
4
|
+
data.tar.gz: c22651d01977adf376a01549ad6428a2e434615ea96882305ddad18559c63852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdc53974c85bbe6171284fdb47cf7700bb959386d10dd1485722566e40fa6b5c189f861f2e04b900ac23e3a44763ab456a1d979de81a331d3c57707627e7071c
|
7
|
+
data.tar.gz: 6bd7b129a0507bbcee1dab62f6a5a74895042b4800d366c1232d013521165972009889dce1b2a1895d7f89457f6adbf248105ca8abda6fad1fdf5c4f9e7f23bc
|
data/lib/item_models/version.rb
CHANGED
data/lib/models/activity.rb
CHANGED
data/lib/models/bundle.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Restorable
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
included do
|
5
|
+
acts_as_paranoid column: :removed, sentinel_value: false
|
6
|
+
acts_as_paranoid column: :removed_at, sentinel_value: false
|
7
|
+
|
8
|
+
# It seems paranoia bug: method_missing `deleted_at`
|
9
|
+
# when restore with `recovery_window`
|
10
|
+
alias_attribute :deleted_at, :removed_at
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def paranoia_restore_attributes
|
15
|
+
{
|
16
|
+
removed_at: nil,
|
17
|
+
removed: false
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
def paranoia_destroy_attributes
|
22
|
+
{
|
23
|
+
removed_at: current_time_from_proper_timezone,
|
24
|
+
removed: nil
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/models/image.rb
CHANGED
data/lib/models/item.rb
CHANGED
data/lib/models/item_listing.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concerns/restorable'
|
3
4
|
class ItemListing < ItemApplicationRecord
|
4
5
|
self.table_name = 'item_channel_associations'
|
6
|
+
include ::Restorable
|
7
|
+
|
5
8
|
belongs_to :item
|
6
9
|
has_many :variant_listings, foreign_key: :channel_association_id
|
7
10
|
has_many :item_listing_images, foreign_key: :channel_association_id
|
@@ -10,4 +13,7 @@ class ItemListing < ItemApplicationRecord
|
|
10
13
|
has_many :item_listing_variant_custom_fields, foreign_key: :channel_association_id
|
11
14
|
has_many :item_listing_custom_fields, foreign_key: :channel_association_id
|
12
15
|
has_many :item_listing_variant_images, foreign_key: :channel_association_id
|
16
|
+
has_one :category,
|
17
|
+
dependent: :destroy,
|
18
|
+
autosave: true
|
13
19
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concerns/restorable'
|
3
4
|
class ItemListingCategory < ItemApplicationRecord
|
4
5
|
self.table_name = 'item_channel_association_categories'
|
6
|
+
include ::Restorable
|
5
7
|
|
6
8
|
belongs_to :item_listing, foreign_key: :channel_association_id
|
7
9
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concerns/restorable'
|
3
4
|
class ItemListingCustomField < ItemApplicationRecord
|
4
5
|
self.table_name = 'item_channel_association_custom_fields'
|
6
|
+
include ::Restorable
|
5
7
|
|
6
8
|
belongs_to :item_listing, foreign_key: :channel_association_id
|
7
9
|
belongs_to :variant
|
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concerns/restorable'
|
3
4
|
class ItemListingImage < ItemApplicationRecord
|
4
5
|
self.table_name = 'item_channel_association_images'
|
6
|
+
include ::Restorable
|
7
|
+
|
5
8
|
belongs_to :image
|
6
9
|
belongs_to :item_listing, foreign_key: :channel_association_id
|
7
10
|
end
|
data/lib/models/variant.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concerns/restorable'
|
3
4
|
class Variant < ItemApplicationRecord
|
4
5
|
self.table_name = 'item_variants'
|
6
|
+
include ::Restorable
|
7
|
+
|
5
8
|
belongs_to :item
|
6
9
|
has_many :variant_images, foreign_key: :item_variant_id
|
7
10
|
has_many :bundles
|
data/lib/models/variant_image.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'concerns/restorable'
|
3
4
|
class VariantListing < ItemApplicationRecord
|
4
5
|
self.table_name = 'item_channel_association_variant_associations'
|
6
|
+
include ::Restorable
|
5
7
|
|
6
8
|
belongs_to :variant
|
7
|
-
belongs_to :item_listing
|
8
|
-
has_one :variant_listing_stock_allocation,
|
9
|
+
belongs_to :item_listing, foreign_key: :channel_association_id
|
10
|
+
has_one :variant_listing_stock_allocation,
|
11
|
+
class_name: 'VariantListingStockAllocation',
|
12
|
+
foreign_key: :variant_association_id
|
9
13
|
has_many :variant_listing_price_histories, foreign_key: :variant_association_id
|
10
14
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: item_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alexander
|
8
|
-
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
@@ -53,10 +52,9 @@ dependencies:
|
|
53
52
|
- - "~>"
|
54
53
|
- !ruby/object:Gem::Version
|
55
54
|
version: '3.0'
|
56
|
-
description:
|
55
|
+
description:
|
57
56
|
email:
|
58
57
|
- alxibra@gmail.com
|
59
|
-
- ivanderkevin1@gmail.com
|
60
58
|
executables: []
|
61
59
|
extensions: []
|
62
60
|
extra_rdoc_files: []
|
@@ -67,6 +65,7 @@ files:
|
|
67
65
|
- lib/models/availability_option.rb
|
68
66
|
- lib/models/bundle.rb
|
69
67
|
- lib/models/bundle_variant.rb
|
68
|
+
- lib/models/concerns/restorable.rb
|
70
69
|
- lib/models/image.rb
|
71
70
|
- lib/models/item.rb
|
72
71
|
- lib/models/item_application_record.rb
|
@@ -86,11 +85,11 @@ files:
|
|
86
85
|
- lib/models/variant_listing_stock_allocation.rb
|
87
86
|
- lib/models/variant_option.rb
|
88
87
|
- lib/models/variant_option_association.rb
|
89
|
-
homepage:
|
88
|
+
homepage:
|
90
89
|
licenses:
|
91
90
|
- MIT
|
92
91
|
metadata: {}
|
93
|
-
post_install_message:
|
92
|
+
post_install_message:
|
94
93
|
rdoc_options: []
|
95
94
|
require_paths:
|
96
95
|
- lib
|
@@ -106,8 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
105
|
- !ruby/object:Gem::Version
|
107
106
|
version: '0'
|
108
107
|
requirements: []
|
109
|
-
rubygems_version: 3.0.
|
110
|
-
signing_key:
|
108
|
+
rubygems_version: 3.0.6
|
109
|
+
signing_key:
|
111
110
|
specification_version: 4
|
112
111
|
summary: gem for active record item models
|
113
112
|
test_files: []
|