Add basic storage for validation events

This commit is contained in:
Alex Sherman 2021-06-29 13:47:38 +05:00
parent 6675dac63d
commit d4fe961e34
5 changed files with 123 additions and 0 deletions

View file

@ -16,6 +16,7 @@ class Contact < ApplicationRecord
has_many :domain_contacts
has_many :domains, through: :domain_contacts
has_many :legal_documents, as: :documentable
has_many :validation_events, as: :validation_eventable
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
has_many :actions, dependent: :destroy

View file

@ -0,0 +1,9 @@
class ValidationEvent < ActiveRecord::Base
enum event_type: ValidationEvent::EventType::TYPES, _suffix: true
belongs_to :validation_eventable, polymorphic: true
def event_type
@event_type ||= ValidationEvent::EventType.new(read_attribute(:event_kind))
end
end

View file

@ -0,0 +1,10 @@
class ValidationEvent
class EventType
TYPES = { email_validation: 'email_validation',
manual_force_delete: 'manual_force_delete' }.freeze
def initialize(event_type)
@event_type = event_type
end
end
end