mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
28 lines
713 B
Ruby
28 lines
713 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Api
|
|
class ShopsController < BaseController
|
|
respond_to :json
|
|
skip_authorization_check only: [:show, :closed_shops]
|
|
|
|
def show
|
|
enterprise = Enterprise.find_by_id(params[:id])
|
|
|
|
render text: Api::EnterpriseShopfrontSerializer.new(enterprise).to_json, status: :ok
|
|
end
|
|
|
|
def closed_shops
|
|
@active_distributor_ids = []
|
|
@earliest_closing_times = []
|
|
|
|
serialized_closed_shops = ActiveModel::ArraySerializer.new(
|
|
ShopsListService.new.closed_shops,
|
|
each_serializer: Api::EnterpriseSerializer,
|
|
data: OpenFoodNetwork::EnterpriseInjectionData.new
|
|
)
|
|
|
|
render json: serialized_closed_shops
|
|
end
|
|
end
|
|
end
|