mirror of
https://github.com/docusealco/docuseal.git
synced 2026-06-23 04:10:11 +00:00
optimize edit json
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TemplatesController < ApplicationController
|
||||
TEMPLATE_FIELDS = %i[id author_id folder_id external_id name slug
|
||||
schema fields submitters variables_schema preferences
|
||||
shared_link source archived_at created_at updated_at].freeze
|
||||
|
||||
load_and_authorize_resource :template
|
||||
|
||||
def show
|
||||
@@ -33,10 +37,11 @@ class TemplatesController < ApplicationController
|
||||
).call
|
||||
|
||||
@template_data =
|
||||
@template.as_json.merge(
|
||||
@template.as_json(only: TEMPLATE_FIELDS).merge(
|
||||
documents: @template.schema_documents.as_json(
|
||||
only: %i[id uuid],
|
||||
methods: %i[metadata signed_key],
|
||||
include: { preview_images: { methods: %i[url metadata filename] } }
|
||||
include: { preview_images: { only: %i[id], methods: %i[url metadata filename] } }
|
||||
)
|
||||
).to_json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user