From 3128232d7ebe7ed152eb06e3d529cb5a45db5ad1 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 20 Jun 2021 09:08:05 +0100 Subject: [PATCH] Create customers controller And add new customers routes. Disable them in production for now. --- app/controllers/api/v1/customers_controller.rb | 15 +++++++++++++++ config/routes/api.rb | 10 ++++++++++ 2 files changed, 25 insertions(+) create mode 100644 app/controllers/api/v1/customers_controller.rb diff --git a/app/controllers/api/v1/customers_controller.rb b/app/controllers/api/v1/customers_controller.rb new file mode 100644 index 0000000000..472e2e92b3 --- /dev/null +++ b/app/controllers/api/v1/customers_controller.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Api + module V1 + class CustomersController < Api::V1::BaseController + def index; end + + def show; end + + def update; end + + def destroy; end + end + end +end diff --git a/config/routes/api.rb b/config/routes/api.rb index 062958c495..9fa70e1d13 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -87,6 +87,16 @@ Openfoodnetwork::Application.routes.draw do constraints: lambda { |_| Flipper.enabled?(:api_reports) } end + unless Rails.env.production? + namespace :v1 do + resources :customers + + resources :enterprises do + resources :customers, only: :index + end + end + end + match '*path', to: redirect(path: "/api/v0/%{path}"), via: :all, constraints: { path: /(?!v[0-9]).+/ } end end