@@ -4,4 +4,39 @@ class Event < ApplicationRecord
44 # include Modelable
55 # include Identifiable
66 # include Elasticsearch::Model
7+
8+ # Attributes
9+ attribute :uuid , :text
10+ attribute :subj_id , :text
11+ attribute :obj_id , :text
12+ attribute :source_id , :string
13+ attribute :aasm_state , :string # could we remove this
14+ attribute :state_event , :string # could we remove this
15+ attribute :callback , :text
16+ attribute :error_messages , :text
17+ attribute :source_token , :text
18+ attribute :created_at , :datetime
19+ attribute :updated_at , :datetime
20+ attribute :indexed_at , :datetime , default : -> { Time . zone . at ( 0 ) }
21+ attribute :occurred_at , :datetime
22+ attribute :message_action , :string , default : "create" # how is this set?
23+ attribute :subj , :text
24+ attribute :obj , :text
25+ attribute :total , :integer , default : 1
26+ attribute :license , :string
27+ attribute :source_doi , :text
28+ attribute :target_doi , :text
29+ attribute :source_relation_type_id , :string
30+ attribute :target_relation_type_id , :string
31+
32+ # Validations
33+ validates :uuid , presence : true , uniqueness : {
34+ case_sensitive : false ,
35+ length : { maximum : 36 } ,
36+ }
37+ validates :subj_id , presence : true
38+ validates :message_action , presence : true , length : { maximum : 191 }
39+ validates :created_at , presence : true
40+ validates :updated_at , presence : true
41+ validates :indexed_at , presence : true
742end
0 commit comments