jararaca 0.2.31__py3-none-any.whl → 0.2.32__py3-none-any.whl

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.

Potentially problematic release.


This version of jararaca might be problematic. Click here for more details.

@@ -1,3 +1,4 @@
1
+ import re
1
2
  from datetime import date, datetime
2
3
  from functools import reduce
3
4
  from typing import Literal, Tuple, TypeVar
@@ -137,25 +138,41 @@ class FilterRuleApplier:
137
138
  case _:
138
139
  raise ValueError(f"Unsupported bool operator: {filter.operator}")
139
140
  elif field_type is int:
141
+ __value = (
142
+ filter.value[0] if isinstance(filter.value, list) else filter.value
143
+ )
144
+ if not re.match(r"^-?\d+$", __value):
145
+ raise ValueError(
146
+ f"Unsupported value type for int field: {type(__value)}"
147
+ )
148
+ number_value = int(__value)
140
149
  match filter.operator:
141
150
  case "=":
142
- return query.filter(field == filter.value)
151
+ return query.filter(field == number_value)
143
152
  case "!=":
144
- return query.filter(field != filter.value)
153
+ return query.filter(field != number_value)
145
154
  case ">":
146
- return query.filter(field > filter.value)
155
+ return query.filter(field > number_value)
147
156
  case "<":
148
- return query.filter(field < filter.value)
157
+ return query.filter(field < number_value)
149
158
  case ">=":
150
- return query.filter(field >= filter.value)
159
+ return query.filter(field >= number_value)
151
160
  case "<=":
152
- return query.filter(field <= filter.value)
161
+ return query.filter(field <= number_value)
153
162
  case "isEmpty":
154
163
  return query.filter(field == None) # noqa
155
164
  case "isNotEmpty":
156
165
  return query.filter(field != None) # noqa
157
166
  case "isAnyOf":
158
- return query.filter(field.in_(filter.value))
167
+ if not isinstance(filter.value, list):
168
+ raise ValueError(
169
+ f"Unsupported value type for isAnyOf operator: {type(filter.value)}"
170
+ )
171
+
172
+ number_values = [
173
+ int(v) for v in filter.value if re.match(r"^-?\d+$", v)
174
+ ]
175
+ return query.filter(field.in_(number_values))
159
176
  case _:
160
177
  raise ValueError(f"Unsupported int operator: {filter.operator}")
161
178
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jararaca
3
- Version: 0.2.31
3
+ Version: 0.2.32
4
4
  Summary: A simple and fast API framework for Python
5
5
  Home-page: https://github.com/LuscasLeo/jararaca
6
6
  Author: Lucas S
@@ -1,6 +1,6 @@
1
1
  LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
2
2
  README.md,sha256=mte30I-ZEJJp-Oax-OganNgl6G9GaCZPL6JVFAvZGz4,7034
3
- pyproject.toml,sha256=B4Nlc2p6KK52GQ0X5NjBeU1WN9gBpXAr-1yR0b7V-5M,1837
3
+ pyproject.toml,sha256=nco-vWu7KyNTRSj1yP_qjFqw3B-lzHJ8aCecPhkhN2o,1837
4
4
  jararaca/__init__.py,sha256=h1lYQMmB8TATPG0GXjIzLZWHbWFhvkAFu-yBjm2W18g,13875
5
5
  jararaca/__main__.py,sha256=-O3vsB5lHdqNFjUtoELDF81IYFtR-DSiiFMzRaiSsv4,67
6
6
  jararaca/cli.py,sha256=fh7lp7rf5xbV5VaoSYWWehktel6BPcOXMjW7cw4wKms,5693
@@ -28,7 +28,7 @@ jararaca/persistence/exports.py,sha256=Ghx4yoFaB4QVTb9WxrFYgmcSATXMNvrOvT8ybPNKX
28
28
  jararaca/persistence/interceptors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  jararaca/persistence/interceptors/aiosqa_interceptor.py,sha256=H6ZjOdosYGCZUzKjugiXQwJkAbnsL4HnkZLOEQhULEc,1986
30
30
  jararaca/persistence/session.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
- jararaca/persistence/sort_filter.py,sha256=fq-YfBJnGSqRK4uaUc9E_aIQiO0Pxo5EooZL5PoUgpM,8312
31
+ jararaca/persistence/sort_filter.py,sha256=A5UsXUuo-vBasZZN0M4C_vGfUVgmhgoGoJzcFc6JkBw,9029
32
32
  jararaca/persistence/utilities.py,sha256=v9ckhzti3GKWQrng2I03EO-dxGRGp-sLoVnVNf_UFU4,12478
33
33
  jararaca/presentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  jararaca/presentation/decorators.py,sha256=eL2YCgMSr19m4YCri5PQU46NRxf0QxsqDnz6MqKu0YQ,8389
@@ -58,8 +58,8 @@ jararaca/tools/app_config/decorators.py,sha256=-ckkMZ1dswOmECdo1rFrZ15UAku--txaN
58
58
  jararaca/tools/app_config/interceptor.py,sha256=nfFZiS80hrbnL7-XEYrwmp2rwaVYBqxvqu3Y-6o_ov4,2575
59
59
  jararaca/tools/metadata.py,sha256=7nlCDYgItNybentPSSCc2MLqN7IpBd0VyQzfjfQycVI,1402
60
60
  jararaca/tools/typescript/interface_parser.py,sha256=_dPBRKs_67eiQ8cPWp8q1uGbIPxZ30dypfoqhbBAL_Y,28790
61
- jararaca-0.2.31.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
62
- jararaca-0.2.31.dist-info/METADATA,sha256=U4wm5ZcJFUbus2tiJHd2rV9GFG0wJc8N_n7qQADy4P8,8552
63
- jararaca-0.2.31.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
64
- jararaca-0.2.31.dist-info/entry_points.txt,sha256=WIh3aIvz8LwUJZIDfs4EeH3VoFyCGEk7cWJurW38q0I,45
65
- jararaca-0.2.31.dist-info/RECORD,,
61
+ jararaca-0.2.32.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
62
+ jararaca-0.2.32.dist-info/METADATA,sha256=X27cj2J9B40gzbZEZaWq0Sktjo_z1Dtx-cwG2350Bp4,8552
63
+ jararaca-0.2.32.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
64
+ jararaca-0.2.32.dist-info/entry_points.txt,sha256=WIh3aIvz8LwUJZIDfs4EeH3VoFyCGEk7cWJurW38q0I,45
65
+ jararaca-0.2.32.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "jararaca"
3
- version = "0.2.31"
3
+ version = "0.2.32"
4
4
  description = "A simple and fast API framework for Python"
5
5
  authors = ["Lucas S <me@luscasleo.dev>"]
6
6
  readme = "README.md"