unidom-party 0.2 → 0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04d6ebcc1baec550d70797be873be4baa5b47463
4
- data.tar.gz: 4c518d32651c4013f573a3406a23a423fbb83fa3
3
+ metadata.gz: a760d7525432b70532d83bd478caa844e4a97c74
4
+ data.tar.gz: cb9a30cccd681d1f7eac1641e36fc56dc2ebb028
5
5
  SHA512:
6
- metadata.gz: c95ff2b9fbf4d3a3743356d2c115301e2444dbe1db16b5e8ce3ddbee9b9e4711730f9f46d66574cb8f5d85645749920f565152f41657b9b17b86afb9a0e93531
7
- data.tar.gz: afbe0d9ff975ad90e8f2be11250faa61bae9506408bf3fa77aebd4cc16da7da0570d78dbfdd4ab481d0ae240b7ff59ae15af7a1f1b457acf26a3dbccdebd290c
6
+ metadata.gz: b675822b65b66b1d33f7b37a411df9189def0927bfff79c5b47e7c022e718e8e986ad773bc69d89e1000ebd89e4c4f10565d5ffaf18d2487993e836cb69fd5cd
7
+ data.tar.gz: eecb39089a974bfc5aff0a1351677b1cf08871ff326264fd7c4566b9abae98e3e37240386941fd47a5ceadceedf515b0b00a7dae76304792e43d5e78157f9f1c
data/README.md CHANGED
@@ -18,7 +18,7 @@ rake db:migrate
18
18
 
19
19
  ## Call the Model
20
20
  ```ruby
21
- Unidom::Party::Company.valid_at.alive.first
21
+ Unidom::Party::PartyRelation.valid_at.alive.first
22
22
  Unidom::Party::Shop.valid_at.alive.first
23
23
  Unidom::Party::People.valid_at.alive.first
24
24
  ```
@@ -0,0 +1,17 @@
1
+ # Government Agency 是政府机构。
2
+ class Unidom::Party::GovernmentAgency < ActiveRecord::Base
3
+
4
+ self.table = 'unidom_government_agencies'
5
+
6
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
7
+
8
+ belongs_to :supervision_region, polymorphic: true
9
+
10
+ has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party
11
+ has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party
12
+
13
+ scope :supervision_region_is, ->(region) { where supervision_region: region }
14
+
15
+ include Unidom::Common::Concerns::ModelExtension
16
+
17
+ end
@@ -0,0 +1,32 @@
1
+ class CreateUnidomGovernmentAgencies < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_government_agencies, id: :uuid do |t|
6
+
7
+ t.references :supervision_region, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+
10
+ t.string :name, null: false, default: '', limit: 200
11
+
12
+ t.column :function_code, 'char(4)', null: false, default: 'ZZZZ'
13
+
14
+ t.text :description
15
+
16
+ t.string :slug, null: false, default: nil, limit: 200
17
+ t.column :state, 'char(1)', null: false, default: 'C'
18
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
19
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
20
+ t.boolean :defunct, null: false, default: false
21
+ t.jsonb :notation, null: false, default: {}
22
+
23
+ t.timestamps null: false
24
+
25
+ end
26
+
27
+ add_index :unidom_government_agencies, :supervision_region_id
28
+ add_index :unidom_government_agencies, :slug, unique: true
29
+
30
+ end
31
+
32
+ end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Party
3
- VERSION = '0.2'.freeze
3
+ VERSION = '0.3'.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.2'
4
+ version: '0.3'
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-02-25 00:00:00.000000000 Z
11
+ date: 2016-03-10 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/government_agency.rb
43
44
  - app/models/unidom/party/party_relation.rb
44
45
  - app/models/unidom/party/person.rb
45
46
  - app/models/unidom/party/shop.rb
@@ -48,6 +49,7 @@ files:
48
49
  - db/migrate/20010101000000_create_unidom_party_relations.rb
49
50
  - db/migrate/20010102000000_create_unidom_people.rb
50
51
  - db/migrate/20010103000000_create_unidom_shops.rb
52
+ - db/migrate/20010104000000_create_unidom_government_agencies.rb
51
53
  - lib/tasks/party_tasks.rake
52
54
  - lib/unidom/party.rb
53
55
  - lib/unidom/party/engine.rb