mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
upgraded pagy to latest version
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -63,10 +63,9 @@ gem 'devise-token_authenticatable'
|
||||
gem 'jwt', '~> 2.3'
|
||||
gem 'oauth2', '~> 1.4.7' # Used for Stripe Connect
|
||||
|
||||
gem 'activesupport'
|
||||
gem 'datafoodconsortium-connector'
|
||||
gem 'jsonapi-serializer'
|
||||
gem 'pagy', '~> 8'
|
||||
gem 'pagy', '~> 9'
|
||||
|
||||
gem 'rswag-api'
|
||||
gem 'rswag-ui'
|
||||
|
||||
@@ -495,7 +495,7 @@ GEM
|
||||
validate_url
|
||||
webfinger (~> 2.0)
|
||||
orm_adapter (0.5.0)
|
||||
pagy (8.6.3)
|
||||
pagy (9.3.4)
|
||||
paper_trail (15.1.0)
|
||||
activerecord (>= 6.1)
|
||||
request_store (~> 1.4)
|
||||
@@ -869,7 +869,6 @@ DEPENDENCIES
|
||||
activerecord-import
|
||||
activerecord-postgresql-adapter
|
||||
activerecord-session_store
|
||||
activesupport
|
||||
acts-as-taggable-on
|
||||
acts_as_list (= 1.0.4)
|
||||
angular-rails-templates (>= 0.3.0)
|
||||
@@ -940,7 +939,7 @@ DEPENDENCIES
|
||||
omniauth_openid_connect
|
||||
openid_connect
|
||||
order_management!
|
||||
pagy (~> 8)
|
||||
pagy (~> 9)
|
||||
paper_trail
|
||||
paranoia (~> 2.4)
|
||||
paypal-sdk-merchant (= 1.117.2)
|
||||
|
||||
@@ -18,7 +18,7 @@ module Api
|
||||
end
|
||||
|
||||
def index
|
||||
@pagy, customers = pagy(search_customers, pagy_options)
|
||||
@pagy, customers = pagy(search_customers, **pagy_options)
|
||||
|
||||
render json: Api::V1::CustomerSerializer.new(customers, pagination_options)
|
||||
end
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
|
||||
require 'pagy/extras/arel'
|
||||
require 'pagy/extras/array'
|
||||
require 'pagy/extras/items'
|
||||
require 'pagy/extras/limit'
|
||||
require 'pagy/extras/overflow'
|
||||
|
||||
# Pagy Variables
|
||||
# See https://ddnexus.github.io/pagy/api/pagy#variables
|
||||
Pagy::DEFAULT[:items] = 100
|
||||
Pagy::DEFAULT[:limit] = 100
|
||||
|
||||
# Items extra: Allow the client to request a custom number of items per page with an optional
|
||||
# limit extra: Allow the client to request a custom number of limit per page with an optional
|
||||
# selector UI
|
||||
# See https://ddnexus.github.io/pagy/extras/items
|
||||
Pagy::DEFAULT[:items_param] = :per_page
|
||||
Pagy::DEFAULT[:max_items] = 100
|
||||
# See https://ddnexus.github.io/pagy/extras/limit
|
||||
Pagy::DEFAULT[:limit_param] = :per_page
|
||||
Pagy::DEFAULT[:limit_max] = 100
|
||||
|
||||
# For handling requests for non-existant pages eg: page 35 when there are only 4 pages of results
|
||||
Pagy::DEFAULT[:overflow] = :empty_page
|
||||
|
||||
@@ -133,7 +133,7 @@ RSpec.describe "Customers", type: :request, swagger_doc: "v1.yaml", feature: :ap
|
||||
it "informs about invalid pages" do
|
||||
get "/api/v1/customers", params: { page: "0" }
|
||||
expect(json_response_ids).to eq nil
|
||||
expect(json_error_detail).to eq 'expected :page >= 1; got "0"'
|
||||
expect(json_error_detail).to eq "expected :page >= 1; got 0"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user