2020-09-04 12:57:19 +02:00
|
|
|
Rails.application.routes.draw do
|
2022-11-07 12:23:54 +01:00
|
|
|
mount Rswag::Ui::Engine => '/api-docs'
|
|
|
|
mount Rswag::Api::Engine => '/api-docs'
|
2011-06-19 20:47:27 +02:00
|
|
|
get "order_comments/new"
|
|
|
|
|
|
|
|
get "comments/new"
|
|
|
|
|
2011-05-11 13:38:46 +02:00
|
|
|
get "sessions/new"
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
root to: 'sessions#redirect_to_foodcoop', as: nil
|
2013-06-06 04:29:53 +02:00
|
|
|
|
2012-08-24 19:52:38 +02:00
|
|
|
scope '/:foodcoop' do
|
2018-10-13 20:16:35 +02:00
|
|
|
use_doorkeeper
|
|
|
|
|
2011-05-11 12:21:21 +02:00
|
|
|
# Root path
|
2015-01-02 17:40:21 +01:00
|
|
|
root to: 'home#index'
|
2009-08-02 18:12:13 +02:00
|
|
|
|
2011-05-11 13:38:46 +02:00
|
|
|
########### Sessions
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
get '/login' => 'sessions#new', as: 'login'
|
|
|
|
get '/logout' => 'sessions#destroy', as: 'logout'
|
2013-10-30 01:56:23 +01:00
|
|
|
get '/login/forgot_password' => 'login#forgot_password', as: :forgot_password
|
|
|
|
post '/login/reset_password' => 'login#reset_password', as: :reset_password
|
|
|
|
get '/login/new_password' => 'login#new_password', as: :new_password
|
2014-10-05 20:35:28 +02:00
|
|
|
patch '/login/update_password' => 'login#update_password', as: :update_password
|
2014-02-20 15:04:53 +01:00
|
|
|
match '/login/accept_invitation/:token' => 'login#accept_invitation', as: :accept_invitation, via: [:get, :post]
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :sessions, only: [:new, :create, :destroy]
|
2011-05-11 13:38:46 +02:00
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
get '/foodcoop.css' => 'styles#foodcoop', as: 'foodcoop_css'
|
2014-08-22 12:06:35 +02:00
|
|
|
|
2011-05-11 12:21:21 +02:00
|
|
|
########### User specific
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
get '/home/profile', as: 'my_profile'
|
2019-11-11 12:09:18 +01:00
|
|
|
get '/home/reference_calculator'
|
2015-01-02 17:40:21 +01:00
|
|
|
patch '/home/update_profile', as: 'update_profile'
|
|
|
|
get '/home/ordergroup' => 'home#ordergroup', as: 'my_ordergroup'
|
|
|
|
post '/home/cancel_membership' => 'home#cancel_membership', as: 'cancel_membership'
|
2011-05-11 12:21:21 +02:00
|
|
|
|
|
|
|
############ Orders, ordering
|
|
|
|
|
|
|
|
resources :orders do
|
|
|
|
member do
|
|
|
|
post :finish
|
|
|
|
post :add_comment
|
2017-08-11 20:58:51 +02:00
|
|
|
post :send_result_to_supplier
|
2013-12-18 21:06:05 +01:00
|
|
|
|
|
|
|
get :receive
|
|
|
|
post :receive
|
2014-10-05 20:35:28 +02:00
|
|
|
|
2023-02-14 16:54:03 +01:00
|
|
|
get :custom_csv
|
2013-12-31 13:46:25 +01:00
|
|
|
get :receive_on_order_article_create
|
2013-12-30 14:34:26 +01:00
|
|
|
get :receive_on_order_article_update
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
2013-12-31 11:41:14 +01:00
|
|
|
|
|
|
|
resources :order_articles
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
|
|
|
|
2017-11-06 18:07:36 +01:00
|
|
|
resources :pickups, only: [:index] do
|
|
|
|
post :document, on: :collection
|
|
|
|
end
|
|
|
|
|
2012-08-24 11:11:40 +02:00
|
|
|
resources :group_orders do
|
2015-01-02 17:40:21 +01:00
|
|
|
get :archive, on: :collection
|
2011-06-19 15:30:33 +02:00
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2014-01-23 16:17:16 +01:00
|
|
|
resources :group_order_articles
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :order_comments, only: [:new, :create]
|
2011-06-19 20:47:27 +02:00
|
|
|
|
2011-05-11 12:21:21 +02:00
|
|
|
############ Foodcoop orga
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :invites, only: [:new, :create]
|
2011-05-11 12:21:21 +02:00
|
|
|
|
|
|
|
resources :tasks do
|
|
|
|
collection do
|
|
|
|
get :user
|
|
|
|
get :archive
|
|
|
|
get :workgroup
|
|
|
|
end
|
2012-10-08 21:52:03 +02:00
|
|
|
member do
|
|
|
|
post :accept
|
|
|
|
post :reject
|
|
|
|
post :set_done
|
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
namespace :foodcoop do
|
2015-01-02 17:40:21 +01:00
|
|
|
root to: 'users#index'
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :users, only: [:index]
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :ordergroups, only: [:index]
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :workgroups, only: [:index, :edit, :update]
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
########### Article management
|
|
|
|
|
|
|
|
resources :stock_takings do
|
|
|
|
collection do
|
2019-05-14 16:24:41 +02:00
|
|
|
get :new_on_stock_article_create
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :stock_articles, controller: 'stockit' do
|
2013-12-07 11:20:03 +01:00
|
|
|
get :copy
|
2011-05-11 12:21:21 +02:00
|
|
|
collection do
|
2013-12-07 16:42:25 +01:00
|
|
|
get :derive
|
2014-10-05 20:35:28 +02:00
|
|
|
|
2013-12-07 11:20:03 +01:00
|
|
|
get :index_on_stock_article_create
|
|
|
|
get :index_on_stock_article_update
|
2014-10-05 20:35:28 +02:00
|
|
|
|
2013-12-07 11:20:03 +01:00
|
|
|
get :show_on_stock_article_update
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :suppliers do
|
2015-01-02 17:40:21 +01:00
|
|
|
get :shared_suppliers, on: :collection
|
2011-05-11 12:21:21 +02:00
|
|
|
|
|
|
|
resources :deliveries do
|
2013-12-07 16:42:25 +01:00
|
|
|
collection do
|
|
|
|
post :add_stock_change
|
2014-10-05 20:35:28 +02:00
|
|
|
|
2013-12-07 16:42:25 +01:00
|
|
|
get :form_on_stock_article_create
|
|
|
|
get :form_on_stock_article_update
|
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
resources :articles do
|
2019-10-14 09:25:34 +02:00
|
|
|
get :copy
|
2011-05-11 12:21:21 +02:00
|
|
|
collection do
|
|
|
|
post :update_selected
|
|
|
|
get :edit_all
|
|
|
|
post :update_all
|
|
|
|
get :upload
|
|
|
|
post :parse_upload
|
|
|
|
post :create_from_upload
|
|
|
|
get :shared
|
|
|
|
get :import
|
|
|
|
post :sync
|
2013-04-08 01:00:49 +02:00
|
|
|
post :update_synchronized
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
|
|
|
end
|
2011-05-11 14:21:06 +02:00
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2011-05-11 14:21:06 +02:00
|
|
|
resources :article_categories
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2011-05-11 14:21:06 +02:00
|
|
|
########### Finance
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2011-05-11 14:21:06 +02:00
|
|
|
namespace :finance do
|
2015-01-02 17:40:21 +01:00
|
|
|
root to: 'base#index'
|
2012-05-12 10:55:20 +02:00
|
|
|
|
|
|
|
resources :order, controller: 'balancing', path: 'balancing' do
|
|
|
|
member do
|
2013-03-17 15:47:50 +01:00
|
|
|
get :update_summary
|
2012-05-12 10:55:20 +02:00
|
|
|
get :edit_note
|
|
|
|
put :update_note
|
2020-03-19 00:22:20 +01:00
|
|
|
get :edit_transport
|
|
|
|
put :update_transport
|
2012-07-27 18:03:46 +02:00
|
|
|
|
|
|
|
get :confirm
|
2017-03-04 14:15:18 +01:00
|
|
|
post :close
|
2014-02-20 15:04:53 +01:00
|
|
|
patch :close_direct
|
2014-10-05 20:35:28 +02:00
|
|
|
|
2013-12-31 13:25:29 +01:00
|
|
|
get :new_on_order_article_create
|
2013-12-30 13:09:49 +01:00
|
|
|
get :new_on_order_article_update
|
2012-05-12 10:55:20 +02:00
|
|
|
end
|
2020-02-28 12:17:27 +01:00
|
|
|
|
|
|
|
post :close_all_direct_with_invoice, on: :collection
|
2012-05-12 10:55:20 +02:00
|
|
|
end
|
|
|
|
|
2016-03-11 13:23:13 +01:00
|
|
|
resources :invoices do
|
2016-05-06 15:04:58 +02:00
|
|
|
get :attachment
|
2016-03-11 13:23:13 +01:00
|
|
|
get :form_on_supplier_id_change, on: :collection
|
2017-10-22 02:21:27 +02:00
|
|
|
get :unpaid, on: :collection
|
2016-03-11 13:23:13 +01:00
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2018-10-11 22:16:50 +02:00
|
|
|
resources :links, controller: 'financial_links', only: [:create, :show] do
|
2019-11-19 12:51:08 +01:00
|
|
|
collection do
|
|
|
|
get :incomplete
|
|
|
|
end
|
2018-10-11 22:16:50 +02:00
|
|
|
member do
|
|
|
|
get :index_bank_transaction
|
|
|
|
put 'bank_transactions/:bank_transaction', action: 'add_bank_transaction', as: 'add_bank_transaction'
|
|
|
|
delete 'bank_transactions/:bank_transaction', action: 'remove_bank_transaction', as: 'remove_bank_transaction'
|
|
|
|
|
|
|
|
get :index_financial_transaction
|
|
|
|
put 'financial_transactions/:financial_transaction', action: 'add_financial_transaction', as: 'add_financial_transaction'
|
|
|
|
delete 'financial_transactions/:financial_transaction', action: 'remove_financial_transaction', as: 'remove_financial_transaction'
|
|
|
|
|
|
|
|
get :index_invoice
|
|
|
|
put 'invoices/:invoice', action: 'add_invoice', as: 'add_invoice'
|
|
|
|
delete 'invoices/:invoice', action: 'remove_invoice', as: 'remove_invoice'
|
2021-02-08 02:47:05 +01:00
|
|
|
|
|
|
|
get :new_financial_transaction
|
|
|
|
post :create_financial_transaction
|
2018-10-11 22:16:50 +02:00
|
|
|
end
|
|
|
|
end
|
2017-10-13 14:36:56 +02:00
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :ordergroups, only: [:index] do
|
|
|
|
resources :financial_transactions, as: :transactions
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
2019-11-01 17:25:20 +01:00
|
|
|
resources :financial_transactions, as: :foodcoop_financial_transactions, path: 'foodcoop/financial_transactions', only: [:index, :new, :create]
|
|
|
|
get :transactions, controller: :financial_transactions, action: :index_collection
|
|
|
|
delete 'transactions/:id', controller: :financial_transactions, action: :destroy, as: :transaction
|
2011-06-09 21:35:05 +02:00
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
get 'transactions/new_collection' => 'financial_transactions#new_collection', as: 'new_transaction_collection'
|
|
|
|
post 'transactions/create_collection' => 'financial_transactions#create_collection', as: 'create_transaction_collection'
|
2018-09-14 19:33:27 +02:00
|
|
|
|
|
|
|
resources :bank_accounts, only: [:index] do
|
2018-10-11 23:26:12 +02:00
|
|
|
member do
|
2017-01-26 13:27:30 +01:00
|
|
|
get :assign_unlinked_transactions
|
2018-10-11 23:26:12 +02:00
|
|
|
get :import
|
2020-02-24 14:22:58 +01:00
|
|
|
post :import
|
2018-10-11 23:26:12 +02:00
|
|
|
end
|
|
|
|
|
2018-09-14 19:33:27 +02:00
|
|
|
resources :bank_transactions, as: :transactions
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :bank_transactions, only: [:index, :show]
|
2011-05-11 14:21:06 +02:00
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2011-05-11 14:21:06 +02:00
|
|
|
########### Administration
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2011-05-11 14:21:06 +02:00
|
|
|
namespace :admin do
|
2015-01-02 17:40:21 +01:00
|
|
|
root to: 'base#index'
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2017-06-28 12:56:56 +02:00
|
|
|
resources :finances, only: [:index] do
|
2018-09-14 19:33:27 +02:00
|
|
|
get :update_bank_accounts, on: :collection
|
2021-03-05 12:44:53 +01:00
|
|
|
get :update_bank_gateways, on: :collection
|
2017-06-28 12:56:56 +02:00
|
|
|
get :update_transaction_types, on: :collection
|
2022-02-20 16:43:20 +01:00
|
|
|
get :update_supplier_categories, on: :collection
|
2017-06-28 12:56:56 +02:00
|
|
|
end
|
|
|
|
|
2018-09-14 19:33:27 +02:00
|
|
|
resources :bank_accounts
|
2021-03-05 12:44:53 +01:00
|
|
|
resources :bank_gateways
|
2017-06-28 12:56:56 +02:00
|
|
|
resources :financial_transaction_classes
|
|
|
|
resources :financial_transaction_types
|
2022-02-20 16:43:20 +01:00
|
|
|
resources :supplier_categories
|
2017-06-28 12:56:56 +02:00
|
|
|
|
2014-10-18 17:52:06 +02:00
|
|
|
resources :users do
|
2016-03-04 19:03:52 +01:00
|
|
|
post :restore, on: :member
|
2015-01-02 17:40:21 +01:00
|
|
|
post :sudo, on: :member
|
2014-10-18 17:52:06 +02:00
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2011-05-11 14:21:06 +02:00
|
|
|
resources :workgroups do
|
2015-01-02 17:40:21 +01:00
|
|
|
get :memberships, on: :member
|
2011-05-11 14:21:06 +02:00
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
|
2011-05-11 14:21:06 +02:00
|
|
|
resources :ordergroups do
|
2015-01-02 17:40:21 +01:00
|
|
|
get :memberships, on: :member
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
2014-03-16 02:08:15 +01:00
|
|
|
|
2017-08-18 09:17:19 +02:00
|
|
|
resources :mail_delivery_status, only: [:index, :show, :destroy] do
|
|
|
|
delete :index, on: :collection, action: :destroy_all
|
|
|
|
end
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resource :config, only: [:show, :update] do
|
2014-03-16 02:08:15 +01:00
|
|
|
get :list
|
|
|
|
end
|
2011-05-11 12:21:21 +02:00
|
|
|
end
|
2011-05-11 13:38:46 +02:00
|
|
|
|
2018-10-13 15:15:43 +02:00
|
|
|
############## API
|
|
|
|
|
|
|
|
namespace :api do
|
|
|
|
namespace :v1 do
|
2018-10-13 15:18:55 +02:00
|
|
|
resource :config, only: [:show]
|
2018-10-13 15:20:27 +02:00
|
|
|
resource :navigation, only: [:show]
|
2019-02-05 20:53:02 +01:00
|
|
|
|
|
|
|
namespace :user do
|
|
|
|
root to: 'users#show'
|
2021-03-01 15:27:26 +01:00
|
|
|
get :financial_overview, to: 'ordergroup#financial_overview'
|
2021-02-18 12:37:22 +01:00
|
|
|
resources :financial_transactions, only: [:index, :show, :create]
|
2018-10-13 16:27:24 +02:00
|
|
|
resources :group_order_articles
|
2019-02-05 20:53:02 +01:00
|
|
|
end
|
2020-07-25 16:18:59 +02:00
|
|
|
|
2021-02-08 01:08:37 +01:00
|
|
|
resources :financial_transaction_classes, only: [:index, :show]
|
2021-02-08 01:08:52 +01:00
|
|
|
resources :financial_transaction_types, only: [:index, :show]
|
2020-07-25 16:18:59 +02:00
|
|
|
resources :financial_transactions, only: [:index, :show]
|
2018-10-13 16:16:44 +02:00
|
|
|
resources :orders, only: [:index, :show]
|
2018-10-13 16:21:37 +02:00
|
|
|
resources :order_articles, only: [:index, :show]
|
2018-10-13 16:27:24 +02:00
|
|
|
resources :group_order_articles
|
2018-10-13 16:29:36 +02:00
|
|
|
resources :article_categories, only: [:index, :show]
|
2018-10-13 15:15:43 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-05-11 15:14:39 +02:00
|
|
|
############## Feedback
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resource :feedback, only: [:new, :create], controller: 'feedback'
|
2013-06-06 04:29:53 +02:00
|
|
|
|
2011-05-11 13:38:46 +02:00
|
|
|
############## The rest
|
|
|
|
|
2015-01-02 17:40:21 +01:00
|
|
|
resources :users, only: [:index]
|
2011-05-11 13:38:46 +02:00
|
|
|
end # End of /:foodcoop scope
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|