grape-listing 1.4.7 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/grape/dsl.rb +4 -3
- data/lib/grape_listing/version.rb +1 -1
- data/lib/listing_service/search.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7592347db2557ed4440d1a1f3aba6c5f689b3bafd51283a0700415fc19ffac63
|
4
|
+
data.tar.gz: 4356d99acc0afe7dd2b7aba09251eb353a972c057bdcbfd587ce60ad407633ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 108cb395525e600c10922475215f8ef63d6ec195ac6da6c444bace446010e2abf0429c8b363eee269f8d5ee066ac89234efb5f24a2e0e3a8e9de534b6d2368d1
|
7
|
+
data.tar.gz: db57306ef8b287b44a57414d84479a34410a0063714b690b8e58c5bbfb5e6910d4d18f448d7796b3aaf509b876e85bcf0af251fcb9cf661d009c7ce702c3a476
|
data/lib/grape/dsl.rb
CHANGED
@@ -4,13 +4,13 @@ module Grape
|
|
4
4
|
module DSL
|
5
5
|
module InsideRoute
|
6
6
|
|
7
|
-
def listing(model:, entity
|
7
|
+
def listing(model:, entity: nil, fields: nil, scopes: nil, search: nil, sortable: nil, paginate: true, cache: nil, preload: nil)
|
8
8
|
# параметры запроса API
|
9
9
|
request_method = request.env['REQUEST_METHOD']
|
10
10
|
request_uri = request.env['REQUEST_URI']
|
11
11
|
|
12
12
|
# опции для сервиса
|
13
|
-
opts = listing_opts(model, entity, scopes, search, sortable, cache, request_method, request_uri, preload)
|
13
|
+
opts = listing_opts(model, entity, fields, scopes, search, sortable, cache, request_method, request_uri, preload)
|
14
14
|
|
15
15
|
if params[:spreadsheet]
|
16
16
|
listing_spreadsheet(**opts)
|
@@ -23,12 +23,13 @@ module Grape
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def listing_opts(model, entity, scopes, search, sortable, cache, request_method, request_uri, preload)
|
26
|
+
def listing_opts(model, entity, fields, scopes, search, sortable, cache, request_method, request_uri, preload)
|
27
27
|
# стандартные опции
|
28
28
|
opts = {
|
29
29
|
model:,
|
30
30
|
preload:,
|
31
31
|
entity:,
|
32
|
+
fields:,
|
32
33
|
scopes:,
|
33
34
|
search:,
|
34
35
|
sortable:,
|
@@ -12,7 +12,7 @@ module GrapeListing
|
|
12
12
|
operator, value = search_operands(field)
|
13
13
|
|
14
14
|
# пропускаем, если параметр для поиска не передан
|
15
|
-
next if value.
|
15
|
+
next if value.nil? || value == '' || value == 'null'
|
16
16
|
|
17
17
|
# кастомный поиск
|
18
18
|
if operator.include?('custom') && value.present?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-listing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Павел Бабин
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|