mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Add a rake task running job & test for job
This commit is contained in:
parent
e110924968
commit
5f0c031410
8 changed files with 92 additions and 105 deletions
|
@ -6,11 +6,20 @@
|
|||
# For email_validation event kind also check_level (regex/mx/smtp) is stored in the event_data
|
||||
class ValidationEvent < ApplicationRecord
|
||||
enum event_type: ValidationEvent::EventType::TYPES, _suffix: true
|
||||
VALIDATION_PERIOD = 1.month.ago.freeze
|
||||
|
||||
store_accessor :event_data, :errors, :check_level, :email
|
||||
|
||||
belongs_to :validation_eventable, polymorphic: true
|
||||
|
||||
scope :recent, -> { where('created_at > ?', VALIDATION_PERIOD) }
|
||||
scope :successful, -> { where(success: true) }
|
||||
|
||||
def self.validated_ids_by(klass)
|
||||
recent.successful.where('validation_eventable_type = ?', klass)
|
||||
.pluck(:validation_eventable_id)
|
||||
end
|
||||
|
||||
def event_type
|
||||
@event_type ||= ValidationEvent::EventType.new(self[:event_kind])
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue