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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9524eeddccf4d92cee8dc8868f82f37ac9c5f4ff
4
- data.tar.gz: 8660b914f124fc0fb7d4f810fe0c29daefa36843
3
+ metadata.gz: b54bc8a3b6ef4de8f7a72449d620dacae0c965fc
4
+ data.tar.gz: 1b721255cf227a7cbe41bad0307f2b4e0e650e6f
5
5
  SHA512:
6
- metadata.gz: 3629bfded56091c44a6e5982eaea1f79ed3ce947e57b47e5601f8a3af6dcacfdd6dfeef6c286f4b77f46bb0ae1f9aae34b7dc3265125f6396c9f048bc4307e40
7
- data.tar.gz: b0d39dbb7e73d7563f03f6619f4d94fee5c9e09868b873b8446309e3be8faa1aeb5d8be12c839226b46bf6190852d0961604e149e28eab4ad00580bdf4cd355e
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
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
+ [![Gem Version](https://badge.fury.io/rb/unidom-action.svg)](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 :subject, polymorphic: true
12
- belongs_to :reason, class_name: 'Unidom::Action::Reason'
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 :subject, type: :uuid, null: false,
7
+ t.references :transitor_visitor, type: :uuid, null: false,
8
8
  polymorphic: { null: false, default: '', limit: 200 }
9
- t.references :reason, type: :uuid, null: true
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
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '0.1'.freeze
3
+ VERSION = '0.2'.freeze
4
4
  end
5
5
  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.1'
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-27 00:00:00.000000000 Z
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