1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-12 23:09:03 +01:00
fab-manager/app/controllers/open_api/v1/prices_controller.rb

24 lines
498 B
Ruby
Raw Normal View History

2022-08-30 14:16:49 +02:00
# frozen_string_literal: true
# public API controller for resources of type Price
class OpenAPI::V1::PricesController < OpenAPI::V1::BaseController
2023-02-24 17:26:55 +01:00
extend OpenAPI::APIDoc
2022-08-30 14:16:49 +02:00
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