Class: Launchpad::API::V2::Admin::IEO::OrdersController

Inherits:
BaseController show all
Defined in:
app/controllers/launchpad/api/v2/admin/ieo/orders_controller.rb

Constant Summary

Constants inherited from BaseController

BaseController::ADMIN_ROLES

Instance Method Summary collapse

Methods inherited from BaseController

#authorize_admin!

Methods included from JWTPayload

#email, #jwt_payload, #role, #uid

Methods included from ExceptionHandlers

included

Methods included from Response

#controller_namespace, #error_response, #errors_response, #json_response, #not_found

Instance Method Details

#indexObject

GET /admin/orders



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/launchpad/api/v2/admin/ieo/orders_controller.rb', line 10

def index
  ransack_params = {
    uid_eq:                         params[:uid],
    state_in:                       params[:state],
    sale_id_eq:                     params[:sale_id],
    sale_pair_id_eq:                params[:sale_pair_id],
    sale_pair_quote_currency_id_eq: params[:quote_unit],
    sale_currency_id_eq:            params[:base_unit]
  }

  orders = Launchpad::IEO::Order.ransack(ransack_params)

  json_response(paginate(orders.result.includes(:sale, :sale_pair)), 200)
end