add template application key
This commit is contained in:
@@ -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))
|
||||||
|
|
||||||
|
|||||||
+14
-13
@@ -4,19 +4,20 @@
|
|||||||
#
|
#
|
||||||
# Table name: templates
|
# Table name: templates
|
||||||
#
|
#
|
||||||
# id :bigint not null, primary key
|
# id :bigint not null, primary key
|
||||||
# deleted_at :datetime
|
# application_key :string
|
||||||
# fields :text not null
|
# deleted_at :datetime
|
||||||
# name :string not null
|
# fields :text not null
|
||||||
# schema :text not null
|
# name :string not null
|
||||||
# slug :string not null
|
# schema :text not null
|
||||||
# source :text not null
|
# slug :string not null
|
||||||
# submitters :text not null
|
# source :text not null
|
||||||
# created_at :datetime not null
|
# submitters :text not null
|
||||||
# updated_at :datetime not null
|
# created_at :datetime not null
|
||||||
# account_id :bigint not null
|
# updated_at :datetime not null
|
||||||
# author_id :bigint not null
|
# account_id :bigint not null
|
||||||
# folder_id :bigint not null
|
# author_id :bigint not null
|
||||||
|
# folder_id :bigint not null
|
||||||
#
|
#
|
||||||
# Indexes
|
# Indexes
|
||||||
#
|
#
|
||||||
|
|||||||
+1
-1
@@ -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
|
||||||
+2
-1
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user