forest_admin_datasource_toolkit 1.8.7 → 1.8.8
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/forest_admin_datasource_toolkit/components/query/condition_tree/operators.rb +2 -0
- data/lib/forest_admin_datasource_toolkit/validations/condition_tree_validator.rb +8 -1
- data/lib/forest_admin_datasource_toolkit/validations/rules.rb +25 -5
- data/lib/forest_admin_datasource_toolkit/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: 765750cee48787840ef311dee5db3e75e219a7e56cfb78907c914904cfe468d0
|
4
|
+
data.tar.gz: 8d44300384715fd36a994f78ab4492ba847bcdc968b1c2c858e13b8ec1fa14c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c772d304439860070f7b188f812e3217c00a4eb597df5043539b0fc665b6f7700cdeda8a85a7c6725a85b196a6467a674df4bced0071052fe908bbdba244959
|
7
|
+
data.tar.gz: 1e321c0d06f17dc0daa9f60d77660ec009cb28b0c1aab2cae51b0bbd08c9c3d0bb6a9ae217cc54480c4241cd7a32bc5befb0bb152f9c5d60e82fcb127e9738d4
|
@@ -7,6 +7,8 @@ module ForestAdminDatasourceToolkit
|
|
7
7
|
NOT_EQUAL = 'not_equal'.freeze
|
8
8
|
LESS_THAN = 'less_than'.freeze
|
9
9
|
GREATER_THAN = 'greater_than'.freeze
|
10
|
+
LESS_THAN_OR_EQUAL = 'less_than_or_equal'.freeze
|
11
|
+
GREATER_THAN_OR_EQUAL = 'greater_than_or_equal'.freeze
|
10
12
|
MATCH = 'match'.freeze
|
11
13
|
LIKE = 'like'.freeze
|
12
14
|
I_LIKE = 'i_like'.freeze
|
@@ -66,13 +66,20 @@ module ForestAdminDatasourceToolkit
|
|
66
66
|
|
67
67
|
def self.throw_if_value_not_allowed_with_column_type(leaf, column_schema)
|
68
68
|
# exclude some cases where the value is not related to the columnType of the field
|
69
|
+
# or where the operator accepts multiple column types (making the value type flexible)
|
69
70
|
excluded_cases = [
|
70
71
|
Operators::SHORTER_THAN,
|
71
72
|
Operators::LONGER_THAN,
|
72
73
|
Operators::AFTER_X_HOURS_AGO,
|
73
74
|
Operators::BEFORE_X_HOURS_AGO,
|
74
75
|
Operators::PREVIOUS_X_DAYS,
|
75
|
-
Operators::PREVIOUS_X_DAYS_TO_DATE
|
76
|
+
Operators::PREVIOUS_X_DAYS_TO_DATE,
|
77
|
+
# Comparison operators that work on multiple column types (String, Number, Date, etc.)
|
78
|
+
# The value type validation is already handled by throw_if_value_not_allowed_with_operator
|
79
|
+
Operators::GREATER_THAN,
|
80
|
+
Operators::LESS_THAN,
|
81
|
+
Operators::GREATER_THAN_OR_EQUAL,
|
82
|
+
Operators::LESS_THAN_OR_EQUAL
|
76
83
|
]
|
77
84
|
|
78
85
|
return if excluded_cases.include?(leaf.operator)
|
@@ -41,29 +41,49 @@ module ForestAdminDatasourceToolkit
|
|
41
41
|
Operators::SHORTER_THAN,
|
42
42
|
Operators::LIKE,
|
43
43
|
Operators::I_LIKE,
|
44
|
+
Operators::MATCH,
|
44
45
|
Operators::I_CONTAINS,
|
45
46
|
Operators::I_ENDS_WITH,
|
46
|
-
Operators::I_STARTS_WITH
|
47
|
+
Operators::I_STARTS_WITH,
|
48
|
+
Operators::LESS_THAN,
|
49
|
+
Operators::GREATER_THAN,
|
50
|
+
Operators::LESS_THAN_OR_EQUAL,
|
51
|
+
Operators::GREATER_THAN_OR_EQUAL
|
47
52
|
],
|
48
53
|
PrimitiveType::NUMBER => [
|
49
54
|
*Rules::BASE_OPERATORS,
|
50
55
|
*Rules::ARRAY_OPERATORS,
|
51
56
|
Operators::GREATER_THAN,
|
52
|
-
Operators::LESS_THAN
|
57
|
+
Operators::LESS_THAN,
|
58
|
+
Operators::GREATER_THAN_OR_EQUAL,
|
59
|
+
Operators::LESS_THAN_OR_EQUAL
|
53
60
|
],
|
54
61
|
PrimitiveType::DATE => [
|
55
62
|
*Rules::BASE_OPERATORS,
|
56
63
|
*Rules::BASE_DATEONLY_OPERATORS,
|
57
64
|
Operators::BEFORE_X_HOURS_AGO,
|
58
|
-
Operators::AFTER_X_HOURS_AGO
|
65
|
+
Operators::AFTER_X_HOURS_AGO,
|
66
|
+
Operators::LESS_THAN,
|
67
|
+
Operators::GREATER_THAN,
|
68
|
+
Operators::LESS_THAN_OR_EQUAL,
|
69
|
+
Operators::GREATER_THAN_OR_EQUAL
|
59
70
|
],
|
60
71
|
PrimitiveType::TIMEONLY => [
|
61
72
|
*Rules::BASE_OPERATORS,
|
62
73
|
Operators::LESS_THAN,
|
63
|
-
Operators::GREATER_THAN
|
74
|
+
Operators::GREATER_THAN,
|
75
|
+
Operators::LESS_THAN_OR_EQUAL,
|
76
|
+
Operators::GREATER_THAN_OR_EQUAL
|
64
77
|
],
|
65
78
|
PrimitiveType::JSON => [*Rules::BASE_OPERATORS, *Rules::ARRAY_OPERATORS],
|
66
|
-
PrimitiveType::DATEONLY => [
|
79
|
+
PrimitiveType::DATEONLY => [
|
80
|
+
*Rules::BASE_OPERATORS,
|
81
|
+
*Rules::BASE_DATEONLY_OPERATORS,
|
82
|
+
Operators::LESS_THAN,
|
83
|
+
Operators::GREATER_THAN,
|
84
|
+
Operators::LESS_THAN_OR_EQUAL,
|
85
|
+
Operators::GREATER_THAN_OR_EQUAL
|
86
|
+
],
|
67
87
|
PrimitiveType::ENUM => [*Rules::BASE_OPERATORS, *Rules::ARRAY_OPERATORS],
|
68
88
|
PrimitiveType::UUID => [*Rules::BASE_OPERATORS, *Rules::ARRAY_OPERATORS],
|
69
89
|
PrimitiveType::BOOLEAN => [*Rules::BASE_OPERATORS, *Rules::ARRAY_OPERATORS],
|