unidom-position 0.1 → 0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07ee6b61a5feaa110f8bd40d79613884d7bc3fdd
|
4
|
+
data.tar.gz: df3c400795aa75d11a612fa7914a7187a43cc5c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf03a0b9c7184c3c8be7f782f81551deb0900e04a7be0875597ddffabbc41f2acf4609382542c458725ccf2b95201f0ed009e50d1ff60d31c1e9134d5cbb453b
|
7
|
+
data.tar.gz: c42c01194678ea6ac6a97e6ddabf10e9a03db953a355d2b8d9f1e8801f156ccf3aaefda70b40d375f8e037218bf864a99d331cc172b250afefaf0d404fc0d47d
|
data/README.md
CHANGED
@@ -28,4 +28,7 @@ position = Unidom::Position::Position.valid_at.alive.first
|
|
28
28
|
occupation = Unidom::Position::Occupation.valid_at.alive.first
|
29
29
|
|
30
30
|
post = Unidom::Position::Post.valid_at.alive.first
|
31
|
+
|
32
|
+
Unidom::Position::PostReportingStructure.report!(superior_post, inferior_post)
|
33
|
+
|
31
34
|
```
|
@@ -11,4 +11,10 @@ class Unidom::Position::Post < ActiveRecord::Base
|
|
11
11
|
belongs_to :organization, polymorphic: true
|
12
12
|
belongs_to :position, class_name: 'Unidom::Position::Position'
|
13
13
|
|
14
|
+
has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', foreign_key: :superior_post_id, source: :superior_post
|
15
|
+
has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', foreign_key: :inferior_post_id, source: :inferior_post
|
16
|
+
|
17
|
+
has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post
|
18
|
+
has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post
|
19
|
+
|
14
20
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Post Reporting Structure 是岗位汇报结构。
|
2
|
+
|
3
|
+
class Unidom::Position::PostReportingStructure < ActiveRecord::Base
|
4
|
+
|
5
|
+
self.table_name = 'unidom_post_reporting_structures'
|
6
|
+
|
7
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
|
+
|
9
|
+
belongs_to :superior_post, class_name: 'Unidom::Position::Post', foreign_key: :superior_post_id
|
10
|
+
belongs_to :inferior_post, class_name: 'Unidom::Position::Post', foreign_key: :inferior_post_id
|
11
|
+
|
12
|
+
scope :superior_post_is, ->(superior_post) { where superior_post_id: to_id(superior_post) }
|
13
|
+
scope :inferior_post_is, ->(inferior_post) { where inferior_post_id: to_id(inferior_post) }
|
14
|
+
|
15
|
+
def self.report!(superior_post, inferior_post, opened_at = Time.now, elemental = true)
|
16
|
+
self.inferior_post_is(inferior_post).superior_post_is(superior_post).valid_at.alive.first_or_create! opened_at: opened_at, elemental: elemental
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CreateUnidomPostReportingStructures < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_post_reporting_structures, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.references :superior_post, type: :uuid, null: false
|
8
|
+
t.references :inferior_post, type: :uuid, null: false
|
9
|
+
|
10
|
+
t.boolean :elemental, null: false, default: false
|
11
|
+
|
12
|
+
t.text :description
|
13
|
+
t.text :instruction
|
14
|
+
|
15
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
16
|
+
t.datetime :opened_at, null: false, default: Time.utc(1970)
|
17
|
+
t.datetime :closed_at, null: false, default: Time.utc(3000)
|
18
|
+
t.boolean :defunct, null: false, default: false
|
19
|
+
t.jsonb :notation, null: false, default: {}
|
20
|
+
|
21
|
+
t.timestamps null: false
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index :unidom_post_reporting_structures, :superior_post_id
|
26
|
+
add_index :unidom_post_reporting_structures, :inferior_post_id
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
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: '0.
|
4
|
+
version: '0.2'
|
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-06-
|
11
|
+
date: 2016-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -43,11 +43,13 @@ files:
|
|
43
43
|
- app/models/unidom/position/occupation.rb
|
44
44
|
- app/models/unidom/position/position.rb
|
45
45
|
- app/models/unidom/position/post.rb
|
46
|
+
- app/models/unidom/position/post_reporting_structure.rb
|
46
47
|
- app/views/layouts/unidom/position/application.html.erb
|
47
48
|
- config/routes.rb
|
48
49
|
- db/migrate/20040201000000_create_unidom_occupations.rb
|
49
50
|
- db/migrate/20040211000000_create_unidom_positions.rb
|
50
51
|
- db/migrate/20040212000000_create_unidom_posts.rb
|
52
|
+
- db/migrate/20040221000000_create_unidom_post_reporting_structures.rb
|
51
53
|
- lib/tasks/position_tasks.rake
|
52
54
|
- lib/unidom/position.rb
|
53
55
|
- lib/unidom/position/engine.rb
|
@@ -72,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
74
|
version: '0'
|
73
75
|
requirements: []
|
74
76
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.4
|
77
|
+
rubygems_version: 2.6.4
|
76
78
|
signing_key:
|
77
79
|
specification_version: 4
|
78
80
|
summary: Unidom Position Domain Model Engine 职位领域模型引擎
|