synchronize documents generation

This commit is contained in:
Alex Turchyn
2023-07-01 13:16:07 +03:00
parent e55b5b47cd
commit 4180d02a1b
15 changed files with 148 additions and 12 deletions
+31
View File
@@ -0,0 +1,31 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: document_generation_events
#
# id :bigint not null, primary key
# event_name :string not null
# created_at :datetime not null
# updated_at :datetime not null
# submitter_id :bigint not null
#
# Indexes
#
# index_document_generation_events_on_submitter_id (submitter_id)
# index_document_generation_events_on_submitter_id_and_event_name (submitter_id,event_name) UNIQUE WHERE ((event_name)::text = ANY ((ARRAY['start'::character varying, 'complete'::character varying])::text[]))
#
# Foreign Keys
#
# fk_rails_... (submitter_id => submitters.id)
#
class DocumentGenerationEvent < ApplicationRecord
belongs_to :submitter
enum :event_name, {
complete: 'complete',
fail: 'fail',
start: 'start',
retry: 'retry'
}, scope: false
end
+2
View File
@@ -39,6 +39,8 @@ class Submitter < ApplicationRecord
has_many_attached :documents
has_many_attached :attachments
has_many :document_generation_events, dependent: :destroy
def status
if completed_at?
'completed'