update multi tenancy
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
class Api::AuthenticateController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
|
||||
def create
|
||||
emp_id = params[:emp_id]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Api::CustomersController < Api::ApiController
|
||||
skip_before_action :authenticate
|
||||
|
||||
#List all active customers by name
|
||||
def index
|
||||
@customers = Customer.order("name asc")
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
class Api::MembershipsController < ActionController::API
|
||||
#before :authenticate_token
|
||||
|
||||
|
||||
#Add Membership to invoice
|
||||
def create
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
def set_sale_params
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ class Api::Restaurant::MoveController < Api::ApiController
|
||||
def update
|
||||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def move_params
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class Api::ShopsController < Api::ApiController
|
||||
skip_before_action :set_current_tenant_by_subdomain_or_first
|
||||
|
||||
def index
|
||||
@shops = Shop.select('id,logo,name,shop_code,address,phone_no').all
|
||||
|
||||
@@ -3,16 +3,25 @@ module MultiTenancy
|
||||
|
||||
included do
|
||||
set_current_tenant_through_filter if respond_to? :set_current_tenant_through_filter
|
||||
before_action :set_current_tenant_by_subdomain_or_frist if respond_to? :before_action
|
||||
before_action :set_current_tenant_by_subdomain_or_first if respond_to? :before_action
|
||||
helper_method :current_shop if respond_to? :helper_method
|
||||
end
|
||||
|
||||
private
|
||||
def set_current_tenant_by_subdomain_or_frist
|
||||
def set_current_tenant_by_subdomain_or_first
|
||||
find_tenant_by_subdomain_or_frist || not_found
|
||||
end
|
||||
|
||||
def find_tenant_by_subdomain_or_frist
|
||||
if request.subdomains.last && request.subdomains.last != 'www'
|
||||
set_current_tenant(Shop.find_by(subdomain: request.subdomains.last))
|
||||
elsif ENV["SERVER_MODE"] == "application"
|
||||
set_current_tenant(Shop.first)
|
||||
end
|
||||
set_current_tenant(Shop.first) if current_tenant.nil?
|
||||
end
|
||||
|
||||
def not_found
|
||||
head :not_found
|
||||
end
|
||||
|
||||
def current_shop
|
||||
|
||||
Reference in New Issue
Block a user