ish_models 0.0.33.163 → 0.0.33.167

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68d413825a0a694b0bdfd1a6fee4a85812bb2f3d34e0f431d2b0a30c27b29304
4
- data.tar.gz: 3a5a7db6ce515ba7e9711839ab4c10b8f74387abd0e6d38c7bf0510d5e86094b
3
+ metadata.gz: 8fc57636dd6d156f9715cadb415fbf81801fb3f2be1200eb7314e05de8921643
4
+ data.tar.gz: 84702d8af0e9f36a2d5b2cd2e661d4bce3b812a6b5bd13b6d7c2989308264b7a
5
5
  SHA512:
6
- metadata.gz: c6b20eb004d674c488b459c23c12ca284bacefb558e1dfcdf03ce2e9b9548fb92ee7ba0c7452dbefb785b05e908a00f4ebdbda6548db7ae9a59df327944032b1
7
- data.tar.gz: 2de807a995e6523d7ff0251f26a24daa127b3b13c1a00279baa69f72b78f708ff0e4cf5317255b19b8cc1f4b98fc629b4aede0321342b2baa6ab4b6d454f0596
6
+ metadata.gz: c7f085d7f266dab23690e7d1ec73959b11a0f336ab0da53f58a99fc8b2dc7d9d561eddbe6919e410108c6a411f0e5c876e06c549951fe5d3cbdb28b342263b87
7
+ data.tar.gz: 86c44f77e1c70983802830ca62d517844137d1e7a0940033fd372457138cce994901decf15d73fa64b5082e5ad44bec0a87be8a7822b5b544f9bb11698c6d34f
@@ -1,5 +1,5 @@
1
1
 
2
- class CoTailors::Address
2
+ class Address
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
data/lib/city.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  class City
2
2
  include ::Mongoid::Document
3
3
  include ::Mongoid::Timestamps
4
- include AuxModel
5
4
 
6
5
  field :name, :type => String
7
6
  field :description, :type => String, :default => 'The description of this city'
data/lib/gameui/map.rb CHANGED
@@ -87,7 +87,7 @@ class ::Gameui::Map
87
87
 
88
88
  def self.list conditions = { is_trash: false }
89
89
  out = self.order_by( created_at: :desc )
90
- [[nil, nil]] + out.map { |item| [ item.name, item.id ] }
90
+ [[nil, nil]] + out.map { |item| [ item.name, item.id.to_s ] }
91
91
  end
92
92
 
93
93
  def breadcrumbs
data/lib/gameui/marker.rb CHANGED
@@ -4,13 +4,16 @@ class ::Gameui::Marker
4
4
  include Mongoid::Timestamps
5
5
  include Ish::Utils
6
6
 
7
- field :slug
8
- ## @TODO: probably remove this, no reason not to have two markers to the same slug (destination)
9
- validates_uniqueness_of :slug, scope: :map_id
10
- validates_presence_of :slug
11
-
12
7
  field :name, type: String
13
- validates :name, presence: true
8
+ validates_uniqueness_of :name, scope: :map_id
9
+ validates_presence_of :name
10
+
11
+ ## This is not a map, I don't need a slug.
12
+ ## @TODO: remove it. _vp_ 2022-06-17
13
+ field :slug
14
+ def slug
15
+ return self[:slug] || id.to_s
16
+ end
14
17
 
15
18
  field :ordering, type: String, default: 'jjj'
16
19
 
@@ -31,8 +34,8 @@ class ::Gameui::Marker
31
34
  field :deleted_at, type: Time, default: nil # @TODO: replace with paranoia
32
35
 
33
36
  ## @TODO: abstract this into a module
34
- field :x, :type => Float
35
- field :y, :type => Float
37
+ field :x, :type => Float, default: 0
38
+ field :y, :type => Float, default: 0
36
39
 
37
40
  field :is_public, type: Boolean, default: true
38
41
  def self.public
@@ -54,19 +57,7 @@ class ::Gameui::Marker
54
57
 
55
58
  belongs_to :map, class_name: '::Gameui::Map', inverse_of: :markers
56
59
 
57
- belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
58
- before_validation :set_destination
59
- def set_destination
60
- d = Map.where({ slug: slug }).first
61
-
62
- puts! self, '#set_destination'
63
-
64
- if !d
65
- self.errors.add( "Cannot save marker, destination |#{slug}| not found." )
66
- return
67
- end
68
- self.destination_id = d.id
69
- end
60
+ belongs_to :destination, class_name: '::Gameui::Map', inverse_of: :from_markers
70
61
 
71
62
  belongs_to :creator_profile, class_name: 'Ish::UserProfile', inverse_of: :my_markers
72
63
 
@@ -98,11 +89,8 @@ class ::Gameui::Marker
98
89
  end
99
90
  end
100
91
 
101
- field :centerOffsetX, type: Integer, default: 0
102
- # validates :centerXOffset, presence: true
103
-
104
- field :centerOffsetY, type: Integer, default: 0
105
- # validates :centerYOffset, presence: true
92
+ field :centerOffsetX, type: Float, default: 0
93
+ field :centerOffsetY, type: Float, default: 0
106
94
 
107
95
 
108
96
 
data/lib/ish/lead.rb CHANGED
@@ -7,7 +7,7 @@ class Ish::Lead
7
7
  include Mongoid::Document
8
8
  include Mongoid::Timestamps
9
9
 
10
- store_in :collection => 'ish_lead'
10
+ store_in :collection => 'ish_leads'
11
11
 
12
12
  belongs_to :profile, :class_name => '::Ish::UserProfile'
13
13
 
@@ -49,3 +49,6 @@ class Ish::Lead
49
49
  field :extra, :type => Array, :default => []
50
50
 
51
51
  end
52
+
53
+ Lead = Ish::Lead
54
+
@@ -0,0 +1,11 @@
1
+
2
+ class Ish::Unsubscribe
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ field :email
7
+ field :unsubscribed_at
8
+ field :reason
9
+
10
+ end
11
+
@@ -31,6 +31,9 @@ class Ish::UserProfile
31
31
  field :lang, default: 'en'
32
32
 
33
33
  ROLES = [ :admin, :manager, :guy ]
34
+ ROLE_ADMIN = :admin
35
+ ROLE_MANAGER = :manager
36
+ ROLE_GUY = :guy
34
37
  field :role_name, :type => Symbol
35
38
 
36
39
  has_one :profile_photo, :class_name => 'Photo', :inverse_of => :profile_city
data/lib/ish_models.rb CHANGED
@@ -42,10 +42,10 @@ require 'ish/issue'
42
42
  require 'ish/lead'
43
43
  require 'ish/payment'
44
44
  require 'ish/premium_item'
45
+ require 'ish/unsubscribe'
45
46
  require 'ish/utils'
46
47
  require 'ish/user_profile'
47
48
 
48
- require 'aux_model'
49
49
  require 'city'
50
50
  require 'cities_user'
51
51
  require 'country'
data/lib/site.rb CHANGED
@@ -2,7 +2,6 @@ class Site
2
2
 
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
- include AuxModel
6
5
 
7
6
  field :domain, :type => String
8
7
  validates_presence_of :domain
data/lib/tag.rb CHANGED
@@ -4,10 +4,10 @@ class Tag
4
4
  include Ish::Utils
5
5
 
6
6
  field :name, :type => String
7
- validates :name, :uniqueness => true, :allow_nil => false
7
+ validates :name, uniqueness: true, presence: true, allow_nil: false # @TODO: tags should only be unique globally, and per-user.
8
8
 
9
9
  field :slug
10
- validates :slug, :uniqueness => true, presence: true, allow_nil: false
10
+ validates :slug, uniqueness: true, presence: true, allow_nil: false
11
11
 
12
12
  field :descr, :type => String, :default => ''
13
13
 
data/lib/video.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'mongoid/paranoia'
2
+
1
3
  class Video
2
4
  include Mongoid::Document
3
5
  include Mongoid::Timestamps
@@ -10,8 +12,6 @@ class Video
10
12
  field :name, :type => String
11
13
  field :descr, :type => String, :as => :description
12
14
 
13
- # default_scope ->{ where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc }) }
14
-
15
15
  field :is_trash, :type => Boolean, :default => false
16
16
  def is_trash
17
17
  if deleted_at
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.163
4
+ version: 0.0.33.167
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -114,15 +114,9 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
- - lib/aux_model.rb
117
+ - lib/address.rb
118
118
  - lib/cities_user.rb
119
119
  - lib/city.rb
120
- - lib/co_tailors/README.txt
121
- - lib/co_tailors/address.rb
122
- - lib/co_tailors/order.rb
123
- - lib/co_tailors/order_item.rb
124
- - lib/co_tailors/product.rb
125
- - lib/co_tailors/profile_measurement.rb
126
120
  - lib/country.rb
127
121
  - lib/event.rb
128
122
  - lib/feature.rb
@@ -145,6 +139,7 @@ files:
145
139
  - lib/ish/payment.rb
146
140
  - lib/ish/premium_item.rb
147
141
  - lib/ish/railtie.rb
142
+ - lib/ish/unsubscribe.rb
148
143
  - lib/ish/user_profile.rb
149
144
  - lib/ish/utils.rb
150
145
  - lib/ish_models.rb
data/lib/aux_model.rb DELETED
@@ -1,22 +0,0 @@
1
-
2
- module AuxModel
3
-
4
- def add_newsitem item
5
- n = Newsitem.new
6
- case item.class.name
7
- when 'Video'
8
- n.video_id = item.id
9
- when 'Photo'
10
- raise 'Not Implemented'
11
- when 'Report'
12
- raise 'Not Implemented'
13
- when 'Gallery'
14
- raise 'Not Implmented'
15
- else
16
- raise 'Not Implemented'
17
- end
18
- self.newsitems << n
19
- self.save
20
- end
21
-
22
- end
@@ -1,2 +0,0 @@
1
-
2
- namespace co_tailors is trash. It'd take me too much eddors, and I'd rather use SpreeCommerce.
@@ -1,26 +0,0 @@
1
- require_relative 'order_item'
2
-
3
- class CoTailors::Order
4
- include Mongoid::Document
5
- include Mongoid::Timestamps
6
-
7
- belongs_to :profile, :class_name => '::Ish::UserProfile'
8
-
9
- has_many :items, :class_name => '::CoTailors::OrderItem'
10
-
11
- field :submitted_at, :type => Time
12
-
13
- MEASUREMENT_PARAMS = [ :neck_around, :chest_around, :waist_around, :sleeve_length, :shoulder_width, :shirt_length, :bicep_around ]
14
-
15
- def grand_total
16
- tax = 0.05
17
- shipping = 0 # 1200
18
-
19
- subtotal = items.all.map { |i| i.cost }.reduce( :+ )
20
- subtotal = subtotal * (tax + 1)
21
- subtotal += shipping
22
- return subtotal.to_i
23
- end
24
-
25
- end
26
-
@@ -1,29 +0,0 @@
1
-
2
- class CoTailors::OrderItem
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- belongs_to :order, :class_name => 'CoTailors::Order'
7
-
8
- KIND_SHIRT = 'const-kind-shirt'
9
- KIND_PANTS = 'const-kind-pants'
10
- KIND_SUIT = 'const-kind-suits'
11
- KINDS = %w{ const-kind-shirt const-kind-pants const-kind-suits }
12
- field :kind, :type => String
13
- validates :kind, :presence => true
14
-
15
- FABRICS = [ :white, :black, :light_blue, :dark_blue, :dark_green, :pink, :gray ]
16
- field :fabric, :type => String
17
- validates :fabric, :presence => true
18
-
19
- has_one :measurement, :class_name => 'CoTailors::ProfileMeasurement'
20
- validates :measurement, :presence => true
21
-
22
- field :quantity, :type => Integer
23
- validates :quantity, :presence => true
24
-
25
- field :cost, :type => Integer # pennies!
26
- validates :cost, :presence => true
27
-
28
- end
29
-
@@ -1,16 +0,0 @@
1
-
2
- class CoTailors::Product
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :cost, :type => Integer
7
- field :title, :type => String
8
- field :description, :type => String
9
-
10
- KINDS = %w( shirt pants suit )
11
- field :kind, :type => String
12
- index({ :kind => -1 })
13
- validates_uniqueness_of :kind
14
-
15
- end
16
-
@@ -1,32 +0,0 @@
1
-
2
- class CoTailors::ProfileMeasurement
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- UNITS = [ :inches, :centimeters ]
7
- UNITS_INCHES = :inches
8
- UNITS_CENTIMETERS = :centimeters
9
- field :units, :type => Symbol
10
-
11
- belongs_to :profile, :class_name => 'Ish::UserProfile', :optional => true
12
- belongs_to :order_item, :class_name => 'CoTailors::OrderItem', :optional => true
13
-
14
- ## shirt
15
- field :neck_around, :type => Float, :default => 0
16
- field :chest_around, :type => Float, :default => 0
17
- field :waist_around, :type => Float, :default => 0
18
- field :sleeve_length, :type => Float, :default => 0
19
- field :shoulder_width, :type => Float, :default => 0
20
- field :shirt_length, :type => Float, :default => 0
21
- field :bicep_around, :type => Float, :default => 0
22
- field :wrist_around, :type => Float, :default => 0 # Is this optional? I want less here
23
- ## pants
24
- # length
25
- # waist
26
- # hips
27
- ## suit
28
-
29
- field :nickname
30
-
31
- end
32
-