motor-admin 0.1.61 → 0.1.62
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/motor/api_query/filter.rb +11 -1
- data/lib/motor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b1e931dc58724b3ae9e207d86d4ca7a9c68d7cfeae0e0c482a7cd21d23c4258
|
|
4
|
+
data.tar.gz: d11ea5ce285bf4c44f6e772970b26bc7deede0b055e7c264c3039833c3d29534
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05bef6829304b10adab88dc9860ad2b97c44a50cce1017cba21efcbc8799a7b996125bcc21abc8dbda3d333e4fd0aaa4200c03a565e51393d9d5c3018b00cd62
|
|
7
|
+
data.tar.gz: 40041861d8e1d81e76065862db59ab88713e799b9859867e91979f1e5ccc73bf6eeab77c3130108ac063da128d3a7d41db1da600c5c50f2301a4ddbefd15a29e
|
|
@@ -4,6 +4,7 @@ module Motor
|
|
|
4
4
|
module ApiQuery
|
|
5
5
|
module Filter
|
|
6
6
|
LIKE_FILTER_VALUE_REGEXP = /\A%?(.*?)%?\z/.freeze
|
|
7
|
+
DISTINCT_DESTRICTED_COLUMN_TYPES = %i[json point].freeze
|
|
7
8
|
|
|
8
9
|
module_function
|
|
9
10
|
|
|
@@ -12,7 +13,10 @@ module Motor
|
|
|
12
13
|
|
|
13
14
|
normalized_params = normalize_params(Array.wrap(params))
|
|
14
15
|
|
|
15
|
-
rel.filter(normalized_params)
|
|
16
|
+
rel = rel.filter(normalized_params)
|
|
17
|
+
rel = rel.distinct if can_apply_distinct?(rel)
|
|
18
|
+
|
|
19
|
+
rel
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
def normalize_params(params)
|
|
@@ -47,6 +51,12 @@ module Motor
|
|
|
47
51
|
end
|
|
48
52
|
end
|
|
49
53
|
|
|
54
|
+
def can_apply_distinct?(rel)
|
|
55
|
+
rel.columns.none? do |column|
|
|
56
|
+
DISTINCT_DESTRICTED_COLUMN_TYPES.include?(column.type)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
50
60
|
def normalize_action(action, value)
|
|
51
61
|
case action
|
|
52
62
|
when 'includes'
|
data/lib/motor/version.rb
CHANGED