use webhook urls instead of encrypted configs

This commit is contained in:
Alex Turchyn
2024-10-28 20:39:09 +02:00
committed by Pete Matsyburka
parent f669045362
commit 84edb6dbda
50 changed files with 1350 additions and 269 deletions
@@ -67,8 +67,11 @@ module Api
submissions = create_submissions(@template, params)
submissions.each do |submission|
SendSubmissionCreatedWebhookRequestJob.perform_async({ 'submission_id' => submission.id })
@template.account.webhook_urls.with_event('submission.created').each do |webhook_url|
submissions.each do |submission|
SendSubmissionCreatedWebhookRequestJob.perform_async({ 'submission_id' => submission.id,
'webhook_url_id' => webhook_url.id })
end
end
Submissions.send_signature_requests(submissions)
@@ -93,7 +96,10 @@ module Api
else
@submission.update!(archived_at: Time.current)
SendSubmissionArchivedWebhookRequestJob.perform_async('submission_id' => @submission.id)
@submission.account.webhook_urls.with_event('submission.archived').each do |webhook_url|
SendSubmissionArchivedWebhookRequestJob.perform_async({ 'submission_id' => @submission.id,
'webhook_url_id' => webhook_url.id })
end
end
render json: @submission.as_json(only: %i[id archived_at])
@@ -13,7 +13,10 @@ module Api
SubmissionEvents.create_with_tracking_data(submitter, 'view_form', request)
SendFormViewedWebhookRequestJob.perform_async({ 'submitter_id' => submitter.id })
submitter.account.webhook_urls.with_event('form.viewed').each do |webhook_url|
SendFormViewedWebhookRequestJob.perform_async({ 'submitter_id' => submitter.id,
'webhook_url_id' => webhook_url.id })
end
render json: {}
end
@@ -25,7 +25,10 @@ module Api
schema_documents = Templates::CloneAttachments.call(template: cloned_template, original_template: @template)
SendTemplateCreatedWebhookRequestJob.perform_async('template_id' => cloned_template.id)
cloned_template.account.webhook_urls.with_event('template.created').each do |webhook_url|
SendTemplateCreatedWebhookRequestJob.perform_async({ 'template_id' => cloned_template.id,
'webhook_url_id' => webhook_url.id })
end
render json: Templates::SerializeForApi.call(cloned_template, schema_documents)
end
+4 -1
View File
@@ -65,7 +65,10 @@ module Api
@template.update!(template_params)
SendTemplateUpdatedWebhookRequestJob.perform_async('template_id' => @template.id)
@template.account.webhook_urls.with_event('template.updated').each do |webhook_url|
SendTemplateUpdatedWebhookRequestJob.perform_async({ 'template_id' => @template.id,
'webhook_url_id' => webhook_url.id })
end
render json: @template.as_json(only: %i[id updated_at])
end