ish_models 0.0.33.258 → 0.0.33.260

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: 2e1f1bed433ccb852de3a46410a673a4e4552b4f48221f4c286ca15f5b805689
4
- data.tar.gz: 180e91b85001dbdca3d42a7af78a5dabf7fb6b5aa5e92b153e75e5ac7b1d1e2b
3
+ metadata.gz: 6291450aa3af2a529bc54e193556c1463ee7cfaad5161ad2e777cfe39c09b9dd
4
+ data.tar.gz: 36613413540c6348a4b752b1c1d3b32c6ff0d4f00023a92e398a45db1bcea500
5
5
  SHA512:
6
- metadata.gz: ad31349efdde87b88e17797f250a3fc99e7c25fad9d1a38d061a8519f4773e0b30aa065371f9645f025d7390ce3bfecbda8742857139ad96077bcebb1580c8d4
7
- data.tar.gz: cc3390211ef7febde3b27b4f3bddd9dd4916e1bcd128cb6d5587b89c435bd6435002cafe05bd78ec4c09e812c040587d17db793d1384056273d27c83f09a8eff
6
+ metadata.gz: 786129d1e89cff3d9584f90a031421a2bd491780a47c9cc2043d4ab8f38219bb86f5f14447682f697ad9efb69d43c5afce4ad0bc5a6be5549038c151dd70f8e2
7
+ data.tar.gz: f25a822b37ae6f9209318e7c550600792921fa9c82e8561a06563d2f9d3f6f6ddfcd8565063da20d66a6121dd2a8781ac4666e16855795cd589d68dd2c4446bb
data/lib/ish/invoice.rb CHANGED
@@ -9,18 +9,27 @@ class Ish::Invoice
9
9
  include Mongoid::Timestamps
10
10
  include Mongoid::Autoinc
11
11
 
12
- store_in :collection => 'ish_invoice'
12
+ store_in collection: 'ish_invoice'
13
13
 
14
- field :email, :type => String
14
+ field :email, type: String
15
15
 
16
- field :number, :type => Integer
16
+ field :invoice_id, type: String # stripe
17
+
18
+ field :leadset_id, type: Integer
19
+ def leadset
20
+ Leadset.find leadset_id
21
+ end
22
+
23
+ field :number, type: Integer
17
24
  increments :number
18
25
 
19
- field :amount, :type => Integer
26
+ field :amount, type: Integer
20
27
 
21
28
  has_many :payments, :class_name => 'Ish::Payment'
22
- field :paid_amount, :type => Integer, :default => 0
29
+ field :paid_amount, type: Integer, :default => 0
30
+
31
+ field :description, type: String
23
32
 
24
- field :description, :type => String
33
+ field :items, type: Array
25
34
 
26
35
  end
@@ -17,7 +17,6 @@ class Ish::UserProfile
17
17
  validates_format_of :email,:with => /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/
18
18
  validates_uniqueness_of :email
19
19
 
20
-
21
20
  field :name
22
21
 
23
22
  def export_fields
@@ -34,11 +33,16 @@ class Ish::UserProfile
34
33
  field :fb_expires_in
35
34
 
36
35
  field :lang, default: 'en'
36
+ field :leadset_id, type: Integer
37
+ def organization_name
38
+ 'Some Org'
39
+ # ::Leadset.find( leadset_id )&.name
40
+ end
37
41
 
38
- ROLES = [ :guy, :manager, :admin ]
39
42
  ROLE_GUY = :guy
40
43
  ROLE_MANAGER = :manager
41
44
  ROLE_ADMIN = :admin
45
+ ROLES = [ :guy, :manager, :admin ]
42
46
  field :role_name, :type => Symbol, default: :guy
43
47
 
44
48
  has_one :profile_photo, inverse_of: :profile_city, class_name: 'Photo'
@@ -57,7 +61,6 @@ class Ish::UserProfile
57
61
  has_many :newsitems, inverse_of: :profile
58
62
  has_and_belongs_to_many :friends, :class_name => '::Ish::UserProfile', inverse_of: :friendeds
59
63
  has_and_belongs_to_many :friendeds, :class_name => '::Ish::UserProfile', inverse_of: :friends
60
- belongs_to :organization, class_name: '::Wco::Organization', inverse_of: :profile
61
64
 
62
65
  def sudoer?
63
66
  %w( piousbox@gmail.com victor@wasya.co ).include?( self.email )
@@ -82,6 +85,7 @@ class Ish::UserProfile
82
85
 
83
86
  field :is_purchasing, type: Boolean, default: false
84
87
 
88
+ field :customer_id # stripe
85
89
 
86
90
  # used in rake tasks
87
91
  def self.generate delta
data/lib/ish_models.rb CHANGED
@@ -74,7 +74,7 @@ require 'office/email_message'
74
74
  require 'office/email_message_stub'
75
75
  require 'office/scheduled_email_action'
76
76
 
77
- require 'wco/organization'
77
+ # require 'wco/organization' ## Use leadset. _vp_ 2023-08-09
78
78
  require 'wco/product'
79
79
  require 'wco/subscription'
80
80
 
@@ -14,7 +14,7 @@ class Office::EmailConversation
14
14
 
15
15
  field :lead_ids, type: :array, default: []
16
16
  def leads
17
- Lead.find( lead_ids )
17
+ Lead.find( lead_ids.compact )
18
18
  end
19
19
 
20
20
  has_many :email_messages
@@ -1,4 +1,7 @@
1
1
 
2
+ ##
3
+ ## @TODO: merge this into a Leadset (sql) _vp_ 2023-08-09
4
+ ##
2
5
  class Wco::Organization
3
6
  include Mongoid::Document
4
7
  include Mongoid::Timestamps
data/lib/wco/product.rb CHANGED
@@ -4,8 +4,19 @@ class Wco::Product
4
4
  include Mongoid::Timestamps
5
5
 
6
6
  field :name
7
+
7
8
  field :product_id # stripe
9
+ field :price_id # stripe
10
+
11
+ field :price_cents, type: Integer
12
+
13
+ INTERVALS = [ nil, 'day', 'week', 'month', 'year' ]
14
+ field :interval, type: String
8
15
 
9
16
  has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :subscription
10
17
 
18
+ def self.list
19
+ [ [nil,nil] ] + self.all.map { |i| [i.name, i.price_id] }
20
+ end
21
+
11
22
  end
@@ -3,7 +3,7 @@ class Wco::Subscription
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
 
6
- belongs_to :organization, class_name: '::Wco::Organization', inverse_of: :subscriptions
6
+ # belongs_to :organization, class_name: '::Wco::Organization', inverse_of: :subscriptions
7
7
  belongs_to :product, class_name: '::Wco::Product', inverse_of: :subscriptions
8
8
 
9
9
  end
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.258
4
+ version: 0.0.33.260
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -171,7 +171,7 @@ files:
171
171
  - lib/photo.rb
172
172
  - lib/report.rb
173
173
  - lib/video.rb
174
- - lib/wco/organization.rb
174
+ - lib/wco/organization.rb-trash
175
175
  - lib/wco/product.rb
176
176
  - lib/wco/subscription.rb
177
177
  homepage: https://wasya.co