unidom-position 1.4.4 → 1.4.5
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 +4 -4
- data/README.md +34 -8
- data/app/controllers/unidom/position/application_controller.rb +3 -0
- data/app/jobs/unidom/position/application_job.rb +3 -0
- data/app/mailers/unidom/position/application_mailer.rb +3 -0
- data/app/models/unidom/position/application_record.rb +3 -0
- data/app/models/unidom/position/concerns/as_inferior_post.rb +7 -0
- data/app/models/unidom/position/concerns/as_superior_post.rb +7 -0
- data/app/models/unidom/position/occupation.rb +1 -1
- data/app/models/unidom/position/position.rb +1 -1
- data/app/models/unidom/position/post.rb +1 -1
- data/app/models/unidom/position/post_reporting_structure.rb +5 -1
- data/lib/unidom/position/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80e180955365b86c13d846f158c09e0b0d4e8481
|
4
|
+
data.tar.gz: 925df0f09a34d753c08477b0038ec496c30f569c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de79f6dc7e5fcf1bb85e1c3b4d66943721d266551fa447d13d6ae9f3822e12252d190caf4e34fb9987cd5ba3b635b140f53e23084ca69b5ef0c153aeb9df10c7
|
7
|
+
data.tar.gz: e44f83de2faa6d66b64d930b00c6120ac8731a36bfd1ed31f74bffca81da1df4b7d5cc772c9e4f722974e4ff3a3876594cec39d86aa3ecba13eb0a3ba1ffcf31
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Unidom Position 职位领域模型引擎
|
2
2
|
|
3
|
+
[](http://www.rubydoc.info/gems/unidom-position/frames)
|
3
4
|
[](http://opensource.org/licenses/MIT)
|
5
|
+
|
4
6
|
[](https://badge.fury.io/rb/unidom-position)
|
5
7
|
[](https://gemnasium.com/github.com/topbitdu/unidom-position)
|
6
8
|
|
@@ -69,16 +71,40 @@ include Unidom::Position::Concerns::AsSuperiorPost
|
|
69
71
|
|
70
72
|
### As Inferior Post
|
71
73
|
|
72
|
-
The As Inferior Post concern do the following tasks for the includer automatically:
|
73
|
-
|
74
|
-
|
75
|
-
|
74
|
+
The As Inferior Post concern do the following tasks for the includer automatically:
|
75
|
+
|
76
|
+
1. Define the has_many :superior_post_reporting_structures macro as: ``has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :inferior_post, foreign_key: :inferior_post_id``
|
77
|
+
|
78
|
+
2. Define the has_many :superior_posts macro as: ``has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post``
|
79
|
+
|
80
|
+
3. Define the #report_to! method as: ``report_to!(superior_post, at: Time.now, primary: true)``
|
81
|
+
|
76
82
|
4. Define the #report_to? method as: ``report_to?(superior_post, at: Time.now, primary: true)``
|
77
83
|
|
78
84
|
### As Superior Post
|
79
85
|
|
80
|
-
The As Superior Post concern do the following tasks for the includer automatically:
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
The As Superior Post concern do the following tasks for the includer automatically:
|
87
|
+
|
88
|
+
1. Define the has_many :inferior_post_reporting_structures macro as: ``has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :superior_post, foreign_key: :superior_post_id``
|
89
|
+
|
90
|
+
2. Define the has_many :inferior_posts macro as: ``has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post``
|
91
|
+
|
92
|
+
3. Define the #is_reported_to! method as: ``is_reported_to!(by: nil, at: Time.now, primary: true)``
|
93
|
+
|
84
94
|
4. Define the #is_reported_to? method as: ``is_reported_to?(by: nil, at: Time.now, primary: true)``
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
## Disable the Model & Migration
|
99
|
+
|
100
|
+
If you only need the app components other than models, the migrations should be neglected, and the models should not be loaded.
|
101
|
+
```ruby
|
102
|
+
# config/initializers/unidom.rb
|
103
|
+
Unidom::Common.configure do |options|
|
104
|
+
|
105
|
+
options[:neglected_namespaces] = %w{
|
106
|
+
Unidom::Position
|
107
|
+
}
|
108
|
+
|
109
|
+
end
|
110
|
+
```
|
@@ -1,3 +1,6 @@
|
|
1
|
+
##
|
2
|
+
# As Inferior Post 是下级岗位的领域逻辑关注点。
|
3
|
+
|
1
4
|
module Unidom::Position::Concerns::AsInferiorPost
|
2
5
|
|
3
6
|
extend ActiveSupport::Concern
|
@@ -7,6 +10,10 @@ module Unidom::Position::Concerns::AsInferiorPost
|
|
7
10
|
has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :inferior_post, foreign_key: :inferior_post_id
|
8
11
|
has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post
|
9
12
|
|
13
|
+
##
|
14
|
+
# 以下级岗位的身份与上级岗位 superior_post 建立岗位间的上下级汇报关系。
|
15
|
+
# 主要汇报标志是 primary ,缺省为 true 。建立时间是 at ,缺省为当前时间。如:
|
16
|
+
# rails_developer.report_to! project_manager, primary: false
|
10
17
|
def report_to!(superior_post, at: Time.now, primary: true)
|
11
18
|
superior_post_reporting_structures.superior_post_is(superior_post).valid_at(now: at).alive.first_or_create! elemental: primary, opened_at: at
|
12
19
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
##
|
2
|
+
# As Superior Post 是上级岗位的领域逻辑关注点。
|
3
|
+
|
1
4
|
module Unidom::Position::Concerns::AsSuperiorPost
|
2
5
|
|
3
6
|
extend ActiveSupport::Concern
|
@@ -7,6 +10,10 @@ module Unidom::Position::Concerns::AsSuperiorPost
|
|
7
10
|
has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :superior_post, foreign_key: :superior_post_id
|
8
11
|
has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post
|
9
12
|
|
13
|
+
##
|
14
|
+
# 以上级岗位的身份与下级岗位 by 建立岗位间的上下级汇报关系。
|
15
|
+
# 主要汇报标志是 primary ,缺省为 true 。建立时间是 at ,缺省为当前时间。如:
|
16
|
+
# project_manager.is_reported_to! by: rails_developer, primary: false
|
10
17
|
def is_reported_to!(by: nil, at: Time.now, primary: true)
|
11
18
|
inferior_post_reporting_structures.inferior_post_is(by).valid_at(now: at).alive.first_or_create! elemental: primary, opened_at: at
|
12
19
|
end
|
@@ -18,4 +18,4 @@ class Unidom::Position::Occupation < Unidom::Position::ApplicationRecord
|
|
18
18
|
scope :scheme_id_is, ->(scheme_id) { where scheme_id: scheme_id }
|
19
19
|
scope :scheme_type_is, ->(scheme_type) { where scheme_type: scheme_type }
|
20
20
|
|
21
|
-
end
|
21
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Position::Occupation'
|
@@ -14,4 +14,4 @@ class Unidom::Position::Post < Unidom::Position::ApplicationRecord
|
|
14
14
|
belongs_to :organization, polymorphic: true
|
15
15
|
belongs_to :position, class_name: 'Unidom::Position::Position'
|
16
16
|
|
17
|
-
end
|
17
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Position::Post'
|
@@ -13,10 +13,14 @@ class Unidom::Position::PostReportingStructure < Unidom::Position::ApplicationRe
|
|
13
13
|
scope :superior_post_is, ->(superior_post) { where superior_post_id: to_id(superior_post) }
|
14
14
|
scope :inferior_post_is, ->(inferior_post) { where inferior_post_id: to_id(inferior_post) }
|
15
15
|
|
16
|
+
##
|
17
|
+
# 建立岗位间的上下级汇报关系。上级岗位是 superior_post ,下级岗位是 inferior_post 。
|
18
|
+
# 主要汇报标志是 elemental ,缺省为 true 。建立时间是 opened_at ,缺省为当前时间。如:
|
19
|
+
# Unidom::Position::PostReportingStructure.report! superior_post: superior_post, inferior_post: inferior_post
|
16
20
|
def self.report!(superior_post: nil, inferior_post: nil, elemental: true, opened_at: Time.now)
|
17
21
|
raise ArgumentError.new('The superior_post argument is required.') if superior_post.blank?
|
18
22
|
raise ArgumentError.new('The inferior_post argument is required.') if inferior_post.blank?
|
19
23
|
self.inferior_post_is(inferior_post).superior_post_is(superior_post).valid_at.alive.first_or_create! elemental: elemental, opened_at: opened_at
|
20
24
|
end
|
21
25
|
|
22
|
-
end
|
26
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Position::PostReportingStructure'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-position
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.9'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Position domain model engine includes the Occupation, Position, Post, and Position
|
29
29
|
Reporting Structure models. Unidom (统一领域对象模型)是一系列的领域模型引擎。职位领域模型引擎包括职业、职位、岗位及职位报告关系模型。
|