add template application key

pull/109/head
DocuSeal 2 years ago
parent 036f6049a2
commit 14c3c8181b

@ -8,6 +8,7 @@ module Api
templates = Templates.search(@templates, params[:q]) templates = Templates.search(@templates, params[:q])
templates = params[:archived] ? templates.archived : templates.active templates = params[:archived] ? templates.archived : templates.active
templates = templates.where(application_key: params[:application_key]) if params[:application_key].present?
templates = paginate(templates.preload(:author, documents_attachments: :blob)) templates = paginate(templates.preload(:author, documents_attachments: :blob))

@ -5,6 +5,7 @@
# Table name: templates # Table name: templates
# #
# id :bigint not null, primary key # id :bigint not null, primary key
# application_key :string
# deleted_at :datetime # deleted_at :datetime
# fields :text not null # fields :text not null
# name :string not null # name :string not null

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
class AddApplicationIdToSubmitters < ActiveRecord::Migration[7.0] class AddApplicationKeyToSubmitters < ActiveRecord::Migration[7.0]
def change def change
add_column :submitters, :application_key, :string add_column :submitters, :application_key, :string
end end

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddApplicationKeyToTemplates < ActiveRecord::Migration[7.0]
def change
add_column :templates, :application_key, :string
end
end

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_10_17_213639) do ActiveRecord::Schema[7.0].define(version: 2023_11_02_171817) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -173,6 +173,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_17_213639) do
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.text "source", null: false t.text "source", null: false
t.bigint "folder_id", null: false t.bigint "folder_id", null: false
t.string "application_key"
t.index ["account_id"], name: "index_templates_on_account_id" t.index ["account_id"], name: "index_templates_on_account_id"
t.index ["author_id"], name: "index_templates_on_author_id" t.index ["author_id"], name: "index_templates_on_author_id"
t.index ["folder_id"], name: "index_templates_on_folder_id" t.index ["folder_id"], name: "index_templates_on_folder_id"

Loading…
Cancel
Save