mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
24 lines
498 B
Ruby
24 lines
498 B
Ruby
# frozen_string_literal: true
|
|
|
|
# public API controller for resources of type Price
|
|
class OpenAPI::V1::PricesController < OpenAPI::V1::BaseController
|
|
extend OpenAPI::ApiDoc
|
|
include Rails::Pagination
|
|
expose_doc
|
|
|
|
def index
|
|
@prices = PriceService.list(params).order(created_at: :desc)
|
|
|
|
return if params[:page].blank?
|
|
|
|
@prices = @prices.page(params[:page]).per(per_page)
|
|
paginate @prices, per_page: per_page
|
|
end
|
|
|
|
private
|
|
|
|
def per_page
|
|
params[:per_page] || 20
|
|
end
|
|
end
|