Class: Admin::LimitPointsAdjustmentsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- ApplicationController
- BaseController
- Admin::LimitPointsAdjustmentsController
- Defined in:
- app/controllers/admin/limit_points_adjustments_controller.rb
Constant Summary
Constants inherited from BaseController
BaseController::INTERNAL_SERVER_ERROR_MESSAGE
Instance Method Summary collapse
Methods inherited from BaseController
#destroy_session, #identity_cache_memoization, #sign_in_page, #user_developer_session
Methods included from LogrageCustomLogger
Methods included from AdminHelper
#dynamic_pricings_formatter, #link_to_admin_reservations_path_by_id, #link_to_admin_restaurants_path_by_id, #link_to_log, #optional_locales, #optional_locales_with_labels, #staff_signed_in?
Methods included from UpdateLocaleConcern
Methods inherited from ApplicationController
#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=
Methods included from ControllerHelpers
#check_boolean_param, #get_banners, #inventory_params, #reservation_params
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/admin/limit_points_adjustments_controller.rb', line 33 def create @limit_points_adjustment = build_limit_points_adjustment if @limit_points_adjustment.valid? if @limit_points_adjustment.save schedule_adjustment_worker if @limit_points_adjustment.started_at.present? render_success_response else render_error_response end else render_error_response end end |
#destroy ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/admin/limit_points_adjustments_controller.rb', line 48 def destroy if @limit_points_adjustment.destroy # Delete the scheduled job job = SidekiqJob.where(job_class: 'LimitPointsAdjustmentWorker', args: @limit_points_adjustment.id).first Sidekiq::Status.cancel(job.jid) if job.present? render json: { success: true } else render json: @limit_points_adjustment.errors..to_sentence, status: :unprocessable_entity end end |
#index ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/admin/limit_points_adjustments_controller.rb', line 7 def index respond_to do |format| format.html do title: 'Limit Points Usage Adjustment' end format.json do limit_points_adjustments = LimitPointsAdjustment.order(started_at: :desc). page(params[:page] || 1).per(params[:per_page] || 50) return unless stale_etag? limit_points_adjustments, template: false render json: limit_points_adjustments, meta: { total_count: LimitPointsAdjustment.count, }, each_serializer: LimitPointsAdjustmentSerializer, adapter: :json end end end |
#new ⇒ Object
29 30 31 |
# File 'app/controllers/admin/limit_points_adjustments_controller.rb', line 29 def new @limit_points_adjustment = LimitPointsAdjustment.new end |