upgraded pagy to latest version

This commit is contained in:
piyush828-design
2025-04-16 16:02:06 +05:30
parent e76b001348
commit da5cef26db
5 changed files with 11 additions and 13 deletions

View File

@@ -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'

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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