Class: Spree::Api::V2::Operator::PieChartEventsController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Spree::Api::V2::Operator::PieChartEventsController
- Defined in:
- app/controllers/spree/api/v2/operator/pie_chart_events_controller.rb
Constant Summary collapse
- ACCEPTED_KYC_FIELDS =
%i[guest_gender guest_occupation guest_nationality].freeze
- ADDITIONAL_FIELDS =
%i[participation entry_type].freeze
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/controllers/spree/api/v2/operator/pie_chart_events_controller.rb', line 9 def index kyc_fields = fetch_filtered_kyc_fields types = ADDITIONAL_FIELDS + kyc_fields resources = types.map { |type| SpreeCmCommissioner::ChartType.new(type) } render json: SpreeCmCommissioner::V2::Operator::ChartTypeSerializer.new(resources).serializable_hash end |
#resource ⇒ Object
18 19 20 |
# File 'app/controllers/spree/api/v2/operator/pie_chart_events_controller.rb', line 18 def resource @resource = pie_chart_event_aggregator_queries.call end |
#resource_serializer ⇒ Object
22 23 24 |
# File 'app/controllers/spree/api/v2/operator/pie_chart_events_controller.rb', line 22 def resource_serializer SpreeCmCommissioner::V2::Operator::PieChartEventAggregatorSerializer end |