unidom-action 0.1 → 0.2
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 +6 -2
- data/app/models/unidom/action/obsolescence.rb +16 -0
- data/app/models/unidom/action/state_transition.rb +4 -2
- data/db/migrate/20000511000000_create_unidom_state_transitions.rb +8 -2
- data/db/migrate/20000512000000_create_unidom_obsolescences.rb +32 -0
- data/lib/unidom/action/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b54bc8a3b6ef4de8f7a72449d620dacae0c965fc
|
|
4
|
+
data.tar.gz: 1b721255cf227a7cbe41bad0307f2b4e0e650e6f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 570421c1f8e25690cc86d16a2774edce1481f58824ae8de62ba7c9a8f461218ac647c43455c1246b7895708309cccf91d0e264e331117920999a164fb45492ce
|
|
7
|
+
data.tar.gz: 9eb4f087355335bccbab24e64bab2859a3358cb19f235963fefe7454efd25842d4bd196ec17e0e2187325547e13d1d0abec9900d136d3bc2807a17cfb20e65f7
|
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
# Unidom Action
|
|
1
|
+
# Unidom Action 审计领域模型引擎
|
|
2
2
|
|
|
3
3
|
[](http://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://badge.fury.io/rb/unidom-action)
|
|
4
5
|
|
|
5
6
|
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Action domain model engine includes the Reason, State Transition, Obsolescene, and the Acting models.
|
|
6
7
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。审计领域模型引擎包括原因、状态迁移、废弃和行为日志的模型。
|
|
@@ -25,7 +26,10 @@ The migration versions start with 200005.
|
|
|
25
26
|
reason = Unidom::Action::Reason.create! activity_code: 'SRRR', name: 'broken', description: 'The box was broken.'
|
|
26
27
|
# SRRR = Shipment Receipt Rejection Reason
|
|
27
28
|
|
|
29
|
+
user = Unidom::Visitor::User.create!
|
|
28
30
|
person = Unidom::Party::Person.create! name: 'Tim'
|
|
29
31
|
|
|
30
|
-
transition = Unidom::Action::StateTransition.create! reason: reason, subject: person, from_state: 'C', thru_state: 'R'
|
|
32
|
+
transition = Unidom::Action::StateTransition.create! transitor_visitor: user, transitor_party: person, reason: reason, subject: person, from_state: 'C', thru_state: 'R'
|
|
33
|
+
obsolescence = Unidom::Action::Obsolescence.create! obsolescer_visitor: user, obsolescer_party: person, reason: reason, obsolesced: person
|
|
34
|
+
# The reason could be nil.
|
|
31
35
|
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Obsolescence 是废弃。
|
|
2
|
+
# #reason 是原因。
|
|
3
|
+
# #obsolesced 是被废弃的对象。
|
|
4
|
+
|
|
5
|
+
class Unidom::Action::Obsolescence < Unidom::Action::ApplicationRecord
|
|
6
|
+
|
|
7
|
+
self.table_name = 'unidom_obsolescences'
|
|
8
|
+
|
|
9
|
+
include Unidom::Common::Concerns::ModelExtension
|
|
10
|
+
|
|
11
|
+
belongs_to :obsolescer_visitor, polymorphic: true
|
|
12
|
+
belongs_to :obsolescer_party, polymorphic: true
|
|
13
|
+
belongs_to :obsolesced, polymorphic: true
|
|
14
|
+
belongs_to :reason, class_name: 'Unidom::Action::Reason'
|
|
15
|
+
|
|
16
|
+
end
|
|
@@ -8,7 +8,9 @@ class Unidom::Action::StateTransition < Unidom::Action::ApplicationRecord
|
|
|
8
8
|
|
|
9
9
|
include Unidom::Common::Concerns::ModelExtension
|
|
10
10
|
|
|
11
|
-
belongs_to :
|
|
12
|
-
belongs_to :
|
|
11
|
+
belongs_to :transitor_visitor, polymorphic: true
|
|
12
|
+
belongs_to :transitor_party, polymorphic: true
|
|
13
|
+
belongs_to :subject, polymorphic: true
|
|
14
|
+
belongs_to :reason, class_name: 'Unidom::Action::Reason'
|
|
13
15
|
|
|
14
16
|
end
|
|
@@ -4,9 +4,13 @@ class CreateUnidomStateTransitions < ActiveRecord::Migration
|
|
|
4
4
|
|
|
5
5
|
create_table :unidom_state_transitions, id: :uuid do |t|
|
|
6
6
|
|
|
7
|
-
t.references :
|
|
7
|
+
t.references :transitor_visitor, type: :uuid, null: false,
|
|
8
8
|
polymorphic: { null: false, default: '', limit: 200 }
|
|
9
|
-
t.references :
|
|
9
|
+
t.references :transitor_party, type: :uuid, null: false,
|
|
10
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
|
11
|
+
t.references :subject, type: :uuid, null: false,
|
|
12
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
|
13
|
+
t.references :reason, type: :uuid, null: true
|
|
10
14
|
|
|
11
15
|
t.column :from_state, 'char(1)', null: false, default: 'C'
|
|
12
16
|
t.column :thru_state, 'char(1)', null: false, default: 'C'
|
|
@@ -21,6 +25,8 @@ class CreateUnidomStateTransitions < ActiveRecord::Migration
|
|
|
21
25
|
|
|
22
26
|
end
|
|
23
27
|
|
|
28
|
+
add_index :unidom_state_transitions, :transitor_visitor_id
|
|
29
|
+
add_index :unidom_state_transitions, :transitor_party_id
|
|
24
30
|
add_index :unidom_state_transitions, :subject_id
|
|
25
31
|
add_index :unidom_state_transitions, :reason_id
|
|
26
32
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class CreateUnidomObsolescences < ActiveRecord::Migration
|
|
2
|
+
|
|
3
|
+
def change
|
|
4
|
+
|
|
5
|
+
create_table :unidom_obsolescences, id: :uuid do |t|
|
|
6
|
+
|
|
7
|
+
t.references :obsolescer_visitor, type: :uuid, null: false,
|
|
8
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
|
9
|
+
t.references :obsolescer_party, type: :uuid, null: false,
|
|
10
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
|
11
|
+
t.references :obsolesced, type: :uuid, null: false,
|
|
12
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
|
13
|
+
t.references :reason, type: :uuid, null: true
|
|
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_obsolescences, :obsolescer_visitor_id
|
|
26
|
+
add_index :unidom_obsolescences, :obsolescer_party_id
|
|
27
|
+
add_index :unidom_obsolescences, :obsolesced_id
|
|
28
|
+
add_index :unidom_obsolescences, :reason_id
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: unidom-action
|
|
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-09-
|
|
11
|
+
date: 2016-09-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: unidom-common
|
|
@@ -44,12 +44,14 @@ files:
|
|
|
44
44
|
- app/jobs/unidom/action/application_job.rb
|
|
45
45
|
- app/mailers/unidom/action/application_mailer.rb
|
|
46
46
|
- app/models/unidom/action/application_record.rb
|
|
47
|
+
- app/models/unidom/action/obsolescence.rb
|
|
47
48
|
- app/models/unidom/action/reason.rb
|
|
48
49
|
- app/models/unidom/action/state_transition.rb
|
|
49
50
|
- app/views/layouts/unidom/action/application.html.erb
|
|
50
51
|
- config/routes.rb
|
|
51
52
|
- db/migrate/20000501000000_create_unidom_reasons.rb
|
|
52
53
|
- db/migrate/20000511000000_create_unidom_state_transitions.rb
|
|
54
|
+
- db/migrate/20000512000000_create_unidom_obsolescences.rb
|
|
53
55
|
- lib/tasks/action_tasks.rake
|
|
54
56
|
- lib/unidom/action.rb
|
|
55
57
|
- lib/unidom/action/engine.rb
|