ish_models 0.0.33.257 → 0.0.33.259

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: 967e2dc82678bca2b5f7ce4e8d8f323da7f6ac3252f01f68ded8efe59cb3e866
4
- data.tar.gz: 43aba5c773bfa6b9d67e17187a3c87fb11c485999dee49aca29b09e1c71788fe
3
+ metadata.gz: 434c9832f29b5dc7ac32419df75a2144df407572d654af9349730eb3ba72f532
4
+ data.tar.gz: adf60195f2ab27e2569883195553115b5c3d03f852452f5648bb96e19cd3fd7c
5
5
  SHA512:
6
- metadata.gz: 3eccb193daa2a797a4cd7cf5320f3623a416c5232734eb9eb24bf1d4572ab56a83df200c5674f3be6095b32169642641876b575c94c9e030bbc75574f2b2a552
7
- data.tar.gz: e9cfaa83e47b60e0fd69bbc28eccd42e0e6084655329a45095662d9d7dab06818bf7bdb9f648a18f0e165b3f4e52b414fd642de9881c65f6c675b786d5267e6c
6
+ metadata.gz: 8eff90b4979e39b82f502c9a95dbfaed444349bf1659f1f79e4325785863d6d28363e7c9639f963e61368760cdda0e082097028bdc11abd9ad43a56ead2c1953
7
+ data.tar.gz: 19b76388d5b8e12a6b2525586d350412b0e5cd04cc5844ca10b4e457a2d1dd131b085ddb90d6673dc0800f5a0faba0ccdd2c640d9b70ec9046e164e2137075e8
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'
@@ -55,6 +59,8 @@ class Ish::UserProfile
55
59
  has_many :reports, inverse_of: :user_profile
56
60
  has_many :videos, inverse_of: :user_profile
57
61
  has_many :newsitems, inverse_of: :profile
62
+ has_and_belongs_to_many :friends, :class_name => '::Ish::UserProfile', inverse_of: :friendeds
63
+ has_and_belongs_to_many :friendeds, :class_name => '::Ish::UserProfile', inverse_of: :friends
58
64
 
59
65
  def sudoer?
60
66
  %w( piousbox@gmail.com victor@wasya.co ).include?( self.email )
@@ -79,8 +85,6 @@ class Ish::UserProfile
79
85
 
80
86
  field :is_purchasing, type: Boolean, default: false
81
87
 
82
- has_and_belongs_to_many :friends, :class_name => '::Ish::UserProfile', inverse_of: :friendeds
83
- has_and_belongs_to_many :friendeds, :class_name => '::Ish::UserProfile', inverse_of: :friends
84
88
 
85
89
  # used in rake tasks
86
90
  def self.generate delta
data/lib/ish_models.rb CHANGED
@@ -13,6 +13,8 @@ module Manager; end
13
13
 
14
14
  module Office; end
15
15
 
16
+ module Wco; end
17
+
16
18
  module IshModels
17
19
 
18
20
  class << self
@@ -72,6 +74,10 @@ require 'office/email_message'
72
74
  require 'office/email_message_stub'
73
75
  require 'office/scheduled_email_action'
74
76
 
77
+ # require 'wco/organization' ## Use leadset. _vp_ 2023-08-09
78
+ require 'wco/product'
79
+ require 'wco/subscription'
80
+
75
81
 
76
82
 
77
83
 
@@ -0,0 +1,15 @@
1
+
2
+ ##
3
+ ## @TODO: merge this into a Leadset (sql) _vp_ 2023-08-09
4
+ ##
5
+ class Wco::Organization
6
+ include Mongoid::Document
7
+ include Mongoid::Timestamps
8
+
9
+ field :name
10
+ field :customer_id # stripe
11
+
12
+ has_many :profiles, class_name: '::Ish::UserProfile', inverse_of: :organization
13
+ has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :organization
14
+
15
+ end
@@ -0,0 +1,22 @@
1
+
2
+ class Wco::Product
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ field :name
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
15
+
16
+ has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :subscription
17
+
18
+ def self.list
19
+ [ [nil,nil] ] + self.all.map { |i| [i.name, i.price_id] }
20
+ end
21
+
22
+ end
@@ -0,0 +1,9 @@
1
+
2
+ class Wco::Subscription
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ # belongs_to :organization, class_name: '::Wco::Organization', inverse_of: :subscriptions
7
+ belongs_to :product, class_name: '::Wco::Product', inverse_of: :subscriptions
8
+
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.257
4
+ version: 0.0.33.259
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -171,6 +171,9 @@ files:
171
171
  - lib/photo.rb
172
172
  - lib/report.rb
173
173
  - lib/video.rb
174
+ - lib/wco/organization.rb-trash
175
+ - lib/wco/product.rb
176
+ - lib/wco/subscription.rb
174
177
  homepage: https://wasya.co
175
178
  licenses:
176
179
  - Proprietary