add submitters api

This commit is contained in:
Alex Turchyn
2023-08-04 00:40:13 +03:00
parent 63e1246a11
commit 7912c9a1ee
16 changed files with 177 additions and 35 deletions
+3
View File
@@ -9,6 +9,8 @@ require 'action_view/railtie'
require 'action_mailer/railtie'
require 'active_job/railtie'
require './lib/api_path_consider_json_middleware'
Bundler.require(*Rails.groups)
module DocuSeal
@@ -26,5 +28,6 @@ module DocuSeal
config.action_view.frozen_string_literal = true
config.middleware.insert_before ActionDispatch::Static, Rack::Deflater
config.middleware.insert_before ActionDispatch::Static, ApiPathConsiderJsonMiddleware
end
end
+8 -4
View File
@@ -1,5 +1,9 @@
# frozen_string_literal: true
require './lib/auth_with_token_strategy'
Warden::Strategies.add(:auth_token, AuthWithTokenStrategy)
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
@@ -272,10 +276,10 @@ Devise.setup do |config|
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
config.warden do |manager|
# manager.intercept_401 = false
manager.default_strategies(scope: :user).unshift(:auth_token)
end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
+4 -2
View File
@@ -27,9 +27,11 @@ Rails.application.routes.draw do
end
end
namespace :api do
namespace :api, defaults: { format: :json } do
resources :attachments, only: %i[create]
resources :templates, only: %i[update] do
resources :submissions, only: %i[create]
resources :templates, only: %i[update index] do
resources :submissions, only: %i[create]
resources :documents, only: %i[create destroy], controller: 'templates_documents'
end
end