unidom-party 0.3 → 0.4

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
  SHA1:
3
- metadata.gz: a760d7525432b70532d83bd478caa844e4a97c74
4
- data.tar.gz: cb9a30cccd681d1f7eac1641e36fc56dc2ebb028
3
+ metadata.gz: 61585c2ceade9603fd33e013b5c109301b4487b5
4
+ data.tar.gz: d38a703cc7ae2a0513beba318a2d48601e2b267d
5
5
  SHA512:
6
- metadata.gz: b675822b65b66b1d33f7b37a411df9189def0927bfff79c5b47e7c022e718e8e986ad773bc69d89e1000ebd89e4c4f10565d5ffaf18d2487993e836cb69fd5cd
7
- data.tar.gz: eecb39089a974bfc5aff0a1351677b1cf08871ff326264fd7c4566b9abae98e3e37240386941fd47a5ceadceedf515b0b00a7dae76304792e43d5e78157f9f1c
6
+ metadata.gz: cb0d944933995c6a89af4de85239c9fa4d37c99649d311a92bf14cf59062a4cc0cd5c3cc54321a651ba8181c7ac76e2484016d54ca023e35110ed1a8c46cdb73
7
+ data.tar.gz: 45f165af0529b165b089c89eea492ef9696a98018009f9db0199194e853bb5f58a7d7b8d5411d6098f531f5ca8bcb31bd09056b2bd13443dd8fc34f0f70cca14
data/README.md CHANGED
@@ -18,7 +18,15 @@ rake db:migrate
18
18
 
19
19
  ## Call the Model
20
20
  ```ruby
21
- Unidom::Party::PartyRelation.valid_at.alive.first
22
- Unidom::Party::Shop.valid_at.alive.first
23
- Unidom::Party::People.valid_at.alive.first
21
+ company = Unidom::Party::Company.valid_at.alive.first
22
+ company.target_party_relations
23
+
24
+ shop = Unidom::Party::Shop.valid_at.alive.first
25
+ shop.source_party_relations
26
+
27
+ person = Unidom::Party::People.valid_at.alive.first
28
+ person.target_party_relations
29
+
30
+ government_agency = Unidom::Party::GovernmentAgency.valid_at.alive.first
31
+ government_agency.supervision_region
24
32
  ```
@@ -0,0 +1,14 @@
1
+ # Company 是公司。
2
+
3
+ class Unidom::Party::Company < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_companies'
6
+
7
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
+
9
+ has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
10
+ has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
11
+
12
+ include Unidom::Common::Concerns::ModelExtension
13
+
14
+ end
@@ -1,35 +1,13 @@
1
- # Person 是个人。
1
+ # Party Relation 是参与者关系。
2
2
 
3
- class Unidom::Party::Person < ActiveRecord::Base
3
+ class Unidom::Party::PartyRelation < ActiveRecord::Base
4
4
 
5
5
  self.table_name = 'unidom_people'
6
6
 
7
7
  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
8
 
9
- #has_many :source_party_linkings, class_name: 'Party::PartyLinking', as: :source_party
10
- #has_many :linked_shops_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Shop'
11
- #has_many :linked_people_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Person'
12
-
13
- #has_many :target_party_linkings, class_name: 'Party::PartyLinking', as: :target_party
14
- #has_many :linked_shops_as_target, through: :source_party_linkings, source: :source_party, source_type: 'Party::Shop'
15
- #has_many :linked_people_as_target, through: :source_party_linkings, source: :source_party, source_type: 'Party::Person'
16
-
17
- #has_many :allocatings, class_name: 'Property::Allocating', as: :allocatee
18
- #has_many :allocated_tables, through: :allocatings, source: :allocated, source_type: 'Property::Table'
19
-
20
- #has_many :receptions, class_name: 'Visitor::Reception', as: :party
21
- #has_many :recepted_users, through: :receptions, source: :visitor, source_type: 'Visitor::User'
22
-
23
- #has_many :contact_subscriptions, class_name: 'Contact::ContactSubscription', as: :subscriber
24
- #has_many :china_mobile_phone_numbers, through: :contact_subscriptions, source: :contact, source_type: 'Contact::ChinaMobilePhoneNumber'
25
-
26
- has_many :target_linkings, class_name: 'Party::PartyLinking', as: :source_party
27
- #has_many :target_people, through: :target_linkings, source: :target_party, source_type: 'Party::Person'
28
- #has_many :target_shops, through: :target_linkings, source: :target_party, source_type: 'Party::Shop'
29
-
30
- has_many :source_linkings, class_name: 'Party::PartyLinking', as: :target_party
31
- #has_many :source_people, through: :source_linkings, source: :source_party, source_type: 'Party::Person'
32
- #has_many :source_shops, through: :source_linkings, source: :source_party, source_type: 'Party::Shop'
9
+ belongs_to :source_party, polymorphic: true
10
+ belongs_to :target_party, polymorphic: true
33
11
 
34
12
  include Unidom::Common::Concerns::ModelExtension
35
13
 
@@ -6,6 +6,9 @@ class Unidom::Party::Person < ActiveRecord::Base
6
6
 
7
7
  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
8
 
9
+ has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
10
+ has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
11
+
9
12
  #has_many :source_party_linkings, class_name: 'Party::PartyLinking', as: :source_party
10
13
  #has_many :linked_shops_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Shop'
11
14
  #has_many :linked_people_as_source, through: :source_party_linkings, source: :target_party, source_type: 'Party::Person'
@@ -23,11 +26,11 @@ class Unidom::Party::Person < ActiveRecord::Base
23
26
  #has_many :contact_subscriptions, class_name: 'Contact::ContactSubscription', as: :subscriber
24
27
  #has_many :china_mobile_phone_numbers, through: :contact_subscriptions, source: :contact, source_type: 'Contact::ChinaMobilePhoneNumber'
25
28
 
26
- has_many :target_linkings, class_name: 'Party::PartyLinking', as: :source_party
29
+ #has_many :target_linkings, class_name: 'Party::PartyLinking', as: :source_party
27
30
  #has_many :target_people, through: :target_linkings, source: :target_party, source_type: 'Party::Person'
28
31
  #has_many :target_shops, through: :target_linkings, source: :target_party, source_type: 'Party::Shop'
29
32
 
30
- has_many :source_linkings, class_name: 'Party::PartyLinking', as: :target_party
33
+ #has_many :source_linkings, class_name: 'Party::PartyLinking', as: :target_party
31
34
  #has_many :source_people, through: :source_linkings, source: :source_party, source_type: 'Party::Person'
32
35
  #has_many :source_shops, through: :source_linkings, source: :source_party, source_type: 'Party::Shop'
33
36
 
@@ -6,6 +6,9 @@ class Unidom::Party::Shop < ActiveRecord::Base
6
6
 
7
7
  validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
8
8
 
9
+ has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
10
+ has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
11
+
9
12
  include Unidom::Common::Concerns::ModelExtension
10
13
 
11
14
  end
@@ -0,0 +1,26 @@
1
+ class CreateUnidomCompanies < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_companies, id: :uuid do |t|
6
+
7
+ t.string :name, null: false, default: '', limit: 200
8
+ t.text :description
9
+
10
+ t.string :slug, null: false, default: nil, limit: 200
11
+ t.column :state, 'char(1)', null: false, default: 'C'
12
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
13
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
14
+ t.boolean :defunct, null: false, default: false
15
+ t.jsonb :notation, null: false, default: {}
16
+
17
+ t.timestamps null: false
18
+
19
+ end
20
+
21
+ add_index :unidom_companies, :name
22
+ add_index :unidom_companies, :slug, unique: true
23
+
24
+ end
25
+
26
+ end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Party
3
- VERSION = '0.3'.freeze
3
+ VERSION = '0.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-party
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-10 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -40,6 +40,7 @@ files:
40
40
  - app/assets/stylesheets/unidom/party/application.css
41
41
  - app/controllers/unidom/party/application_controller.rb
42
42
  - app/helpers/unidom/party/application_helper.rb
43
+ - app/models/unidom/party/company.rb
43
44
  - app/models/unidom/party/government_agency.rb
44
45
  - app/models/unidom/party/party_relation.rb
45
46
  - app/models/unidom/party/person.rb
@@ -50,6 +51,7 @@ files:
50
51
  - db/migrate/20010102000000_create_unidom_people.rb
51
52
  - db/migrate/20010103000000_create_unidom_shops.rb
52
53
  - db/migrate/20010104000000_create_unidom_government_agencies.rb
54
+ - db/migrate/20010105000000_create_unidom_companies.rb
53
55
  - lib/tasks/party_tasks.rake
54
56
  - lib/unidom/party.rb
55
57
  - lib/unidom/party/engine.rb