unidom-party 1.2 → 1.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: 880d93c7b67cc3ce1e60dd59ed90b260b9f4abac
4
- data.tar.gz: 5c0a772a1e861375c0fcea35c66be01a402e2d3f
3
+ metadata.gz: da6a352066a2a8cbd63b3ac270db33368977474a
4
+ data.tar.gz: 6c1cf67ae25275213333777c8ed84b1a702386be
5
5
  SHA512:
6
- metadata.gz: d272e1ea4e63e8661faf9bb1919cad06c60102fe92d9a467b81876351cb4636c2635b48f0e38e55659e56b747928e5ae54b4b2492e7d8b976a54bc0ea641326a
7
- data.tar.gz: 4a023806269906e34633ff880c14cf0ec7c7a2e8a6b2115713150d7b4c3670cd7258545a970ca733c59c6d2cfbfcfe39b557eadaf273ec9cfcaeebfbdd30e5f2
6
+ metadata.gz: 49762cc91346d650622ebf88e8c802113fcf5f3515c6b9aa9aa742383c417e6fd7c1db6f0d7e094b284d482e66ac17575437553627a6108ba25026ab794b44bb
7
+ data.tar.gz: 3898dd908599567741c0964b31517bce7827b85177496102b0e4b3df90d7c04cfdabda04f0bde92ba84b32b7dce83d154c9a052c1c104d6b70e2440fa5517dda
data/README.md CHANGED
@@ -40,6 +40,8 @@ relation = Unidom::Party::PartyRelation.relate! source_party: company, target_pa
40
40
 
41
41
  Unidom::Party::PartyRelation.source_party_is(company).target_party_is(person).valid_at.alive
42
42
  # Find all relationships from the company & the person, like employment
43
+
44
+ Unidom::Party::Collaborating.create! collaboration: project, collaborator: person, role_code: 'PJMG', name: 'Project Manager'
43
45
  ```
44
46
 
45
47
 
@@ -54,8 +56,10 @@ include Unidom::Party::Concerns::AsTargetParty
54
56
  The As Source Party concern do the following tasks for the includer automatically:
55
57
  1. Define the has_many :target_party_relations macro as: ``has_many :target_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :source_party``
56
58
  2. Define the #relate! method as: ``relate!(to: nil, due_to: nil, at: Time.now)``
59
+ 3. Define the #relate? method as: ``relate?(to: nil, due_to: nil, at: Time.now)``
57
60
 
58
61
  ### As Target Party concern
59
62
  The As Target Party concern do the following tasks for the includer automatically:
60
63
  1. Define the has_many :source_party_relations macro as: ``has_many :source_party_relations, class_name: 'Unidom::Party::PartyRelation', as: :target_party``
61
64
  2. Define the #is_related! method as: ``is_related!(to: nil, due_to: nil, at: Time.now)``
65
+ 3. Define the #is_related? method as: ``is_related?(to: nil, due_to: nil, at: Time.now)``
@@ -0,0 +1,17 @@
1
+ # Collaborating 是参与者以特定的角色进行协作。
2
+
3
+ class Unidom::Party::Collaborating < ActiveRecord::Base
4
+
5
+ self.table_name = 'unidom_collaboratings'
6
+
7
+ include Unidom::Common::Concerns::ModelExtension
8
+
9
+ validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
10
+
11
+ belongs_to :collaboration, polymorphic: true
12
+ belongs_to :collaborator, polymorphic: true
13
+
14
+ scope :collaboration_is, ->(collaboration) { where collaboration: collaboration }
15
+ scope :collaborated_by, ->(collaborator) { where collaborator: collaborator }
16
+
17
+ end
@@ -10,9 +10,9 @@ module Unidom::Party::Concerns::AsSourceParty
10
10
  target_party_relations.create! target_party: to, linkage_code: due_to, opened_at: at
11
11
  end
12
12
 
13
- #def relate?(to: nil, due_to: nil, at: Time.now)
14
- # target_party_relations.target_party_is(to).linkage_coded_as(due_to).valid_at(now: at).alive.exists?
15
- #end
13
+ def relate?(to: nil, due_to: nil, at: Time.now)
14
+ target_party_relations.target_party_is(to).linkage_coded_as(due_to).valid_at(now: at).alive.exists?
15
+ end
16
16
 
17
17
  end
18
18
 
@@ -10,9 +10,9 @@ module Unidom::Party::Concerns::AsTargetParty
10
10
  source_party_relations.create! source_party: to, linkage_code: due_to, opened_at: at
11
11
  end
12
12
 
13
- #def is_related?(to: nil, due_to: nil, at: Time.now)
14
- # source_party_relations.source_party_is(to).linkage_coded_as(due_to).valid_at(now: at).alive.exists?
15
- #end
13
+ def is_related?(to: nil, due_to: nil, at: Time.now)
14
+ source_party_relations.source_party_is(to).linkage_coded_as(due_to).valid_at(now: at).alive.exists?
15
+ end
16
16
 
17
17
  end
18
18
 
@@ -0,0 +1,36 @@
1
+ class CreateUnidomCollaboratings < ActiveRecord::Migration
2
+
3
+ def change
4
+
5
+ create_table :unidom_collaboratings, id: :uuid do |t|
6
+
7
+ t.references :collaboration, type: :uuid, null: false,
8
+ polymorphic: { null: false, default: '', limit: 200 }
9
+ t.references :collaborator, type: :uuid, null: false,
10
+ polymorphic: { null: false, default: '', limit: 200 }
11
+
12
+ t.column :role_code, 'char(4)', null: false, default: 'ZZZZ'
13
+
14
+ t.string :name, null: false, default: '', limit: 200
15
+ t.integer :priority, null: false, default: 0
16
+ t.integer :grade, null: false, default: 0
17
+
18
+ t.text :description
19
+ t.text :instruction
20
+
21
+ t.column :state, 'char(1)', null: false, default: 'C'
22
+ t.datetime :opened_at, null: false, default: ::Time.utc(1970)
23
+ t.datetime :closed_at, null: false, default: ::Time.utc(3000)
24
+ t.boolean :defunct, null: false, default: false
25
+ t.jsonb :notation, null: false, default: {}
26
+
27
+ t.timestamps null: false
28
+
29
+ end
30
+
31
+ add_index :unidom_collaboratings, :collaboration_id
32
+ add_index :unidom_collaboratings, :collaborator_id
33
+
34
+ end
35
+
36
+ end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Party
3
- VERSION = '1.2'.freeze
3
+ VERSION = '1.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: '1.2'
4
+ version: '1.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-09-20 00:00:00.000000000 Z
11
+ date: 2016-10-01 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/collaborating.rb
43
44
  - app/models/unidom/party/company.rb
44
45
  - app/models/unidom/party/concerns/as_source_party.rb
45
46
  - app/models/unidom/party/concerns/as_target_party.rb
@@ -54,6 +55,7 @@ files:
54
55
  - db/migrate/20010103000000_create_unidom_shops.rb
55
56
  - db/migrate/20010104000000_create_unidom_government_agencies.rb
56
57
  - db/migrate/20010105000000_create_unidom_companies.rb
58
+ - db/migrate/20010111000000_create_unidom_collaboratings.rb
57
59
  - lib/tasks/party_tasks.rake
58
60
  - lib/unidom/party.rb
59
61
  - lib/unidom/party/engine.rb