adjust create submission resp

This commit is contained in:
Pete Matsyburka
2024-04-27 22:43:12 +03:00
parent 2c2ef97c30
commit 1b2dec4c2a
5 changed files with 50 additions and 31 deletions
+6 -4
View File
@@ -2,13 +2,15 @@
module Templates
module SerializeForApi
SERIALIZE_PARAMS = {
methods: %i[application_key folder_name],
include: { author: { only: %i[id email first_name last_name] } }
}.freeze
module_function
def call(template, schema_documents = template.schema_documents, preview_image_attachments = [])
json = template.as_json(
methods: %i[application_key folder_name],
include: { author: { only: %i[id email first_name last_name] } }
)
json = template.as_json(SERIALIZE_PARAMS)
json[:documents] = template.schema.map do |item|
attachment = schema_documents.find { |e| e.uuid == item['attachment_uuid'] }