Files
sx-fc/app/controllers/api/sound_effect_controller.rb
Thein Lin Kyaw 937f40e7c1 Single database for multiple shops
Use ActsAsTenant as Multi-tenancy for shops

See below files:
- app/controllers/concern/multi_tenancy.rb
- app/models/application_record.rb
- app/models/shop.rb

An initializer can be created to control option in ActsAsTenant.
config/initializers/acts_as_tenant.rb
require 'acts_as_tenant/sidekiq'
ActsAsTenant.configure do |config|
  config.require_tenant = false # true
end

more details: https://github.com/ErwinM/acts_as_tenant
2019-12-02 17:19:28 +06:30

31 lines
925 B
Ruby

class Api::SoundEffectController < Api::ApiController
#sound effect / alarm api for doemal side calling
def sound_effect
shop = Shop.current_shop
if !shop.nil?
shop_code = shop.shop_code
order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio")
if !order_audio.nil?
audio = order_audio.image
end
else
shop_code = nil
audio = nil
end
if !shop_code.nil? && !audio.nil?
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
else
from = ""
end
ActionCable.server.broadcast "sound_effect_channel",data: {status: params[:status], message: params[:message]},shop_code: shop_code,from:from,audio:audio
else
render :json => { :status => false, :message => "Something wrongs!" }
end
end
#sound effect / alarm api for doemal side calling
end