maleo-foundation 0.2.4__py3-none-any.whl → 0.2.6__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.
@@ -20,10 +20,11 @@ class BaseClientServiceResultsTransfers:
20
20
  def calculate_pagination_component(cls, values: dict) -> dict:
21
21
  """Extracts pagination components (page, limit, total_data) before validation."""
22
22
  pagination = values.get("pagination")
23
-
24
- if isinstance(pagination, BaseGeneralSchemas.ExtendedPagination):
25
- values["page"] = pagination.page
26
- values["limit"] = pagination.limit
27
- values["total_data"] = pagination.total_data
23
+ if pagination is None:
24
+ raise ValueError("Pagination field did not exists")
25
+ pagination = BaseGeneralSchemas.ExtendedPagination.model_validate(pagination)
26
+ values["page"] = pagination.page
27
+ values["limit"] = pagination.limit
28
+ values["total_data"] = pagination.total_data
28
29
 
29
30
  return values
@@ -13,17 +13,17 @@ from maleo_foundation.utils.logging import BaseLogger
13
13
  class BaseExceptions:
14
14
  @staticmethod
15
15
  def authentication_error_handler(request:Request, exc:Exception):
16
- return JSONResponse(content=BaseResponses.Unauthorized(other=str(exc)).model_dump(), status_code=status.HTTP_401_UNAUTHORIZED)
16
+ return JSONResponse(content=BaseResponses.Unauthorized(other=str(exc)).model_dump(mode="json"), status_code=status.HTTP_401_UNAUTHORIZED)
17
17
 
18
18
  @staticmethod
19
19
  async def validation_exception_handler(request:Request, exc:RequestValidationError):
20
- return JSONResponse(content=BaseResponses.ValidationError(other=exc.errors()).model_dump(), status_code=status.HTTP_422_UNPROCESSABLE_ENTITY)
20
+ return JSONResponse(content=BaseResponses.ValidationError(other=exc.errors()).model_dump(mode="json"), status_code=status.HTTP_422_UNPROCESSABLE_ENTITY)
21
21
 
22
22
  @staticmethod
23
23
  async def http_exception_handler(request:Request, exc:StarletteHTTPException):
24
24
  if exc.status_code in BaseResponses.other_responses:
25
- return JSONResponse(content=BaseResponses.other_responses[exc.status_code]["model"]().model_dump(), status_code=exc.status_code)
26
- return JSONResponse(content=BaseResponses.ServerError().model_dump(), status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
25
+ return JSONResponse(content=BaseResponses.other_responses[exc.status_code]["model"]().model_dump(mode="json"), status_code=exc.status_code)
26
+ return JSONResponse(content=BaseResponses.ServerError().model_dump(mode="json"), status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
27
27
 
28
28
  @staticmethod
29
29
  def database_exception_handler(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -80,7 +80,7 @@ maleo_foundation/models/transfers/results/key.py,sha256=H5U8LBodcpCCJmPRw7zkO6sD
80
80
  maleo_foundation/models/transfers/results/signature.py,sha256=lj89dDcQNotM0uWqkz_uXUplGoKXgE4NbaXJfN2m0GI,663
81
81
  maleo_foundation/models/transfers/results/token.py,sha256=4V3UjfrKY1CnCMGlJgwLW-7brHb1_5I7ndY3k0zuL7o,629
82
82
  maleo_foundation/models/transfers/results/client/__init__.py,sha256=xBRuY0NUIPpQEGQ2qoBnqLZGX4W1YSrQ0VnDf5OYJBo,290
83
- maleo_foundation/models/transfers/results/client/service.py,sha256=cRGf2wcMTfvhlEAxtbDayx_pcXFRJPhy29dnVugKGlg,1162
83
+ maleo_foundation/models/transfers/results/client/service.py,sha256=d5fDb9Agnb_szdxZliT8Nbj_uPMoJidQBGpyg-JG6ik,1264
84
84
  maleo_foundation/models/transfers/results/client/controllers/__init__.py,sha256=x5pcJ33rsG8SqecwL1g762DFoySisTLbZqOqKqKoaKU,173
85
85
  maleo_foundation/models/transfers/results/client/controllers/http.py,sha256=vhjfjchvlTq347mLY2mcE84n_xYMpLkALi_ecQNOAGY,1499
86
86
  maleo_foundation/models/transfers/results/encryption/__init__.py,sha256=Uo8lKBcjlvtCjgPk4sz44GY_fjG3QooatbVYBDFwF8g,307
@@ -93,7 +93,7 @@ maleo_foundation/models/transfers/results/service/controllers/__init__.py,sha256
93
93
  maleo_foundation/models/transfers/results/service/controllers/rest.py,sha256=wCuFyOTQkuBs2cqjPsWnPy0XIsCfMqGByhrSy57qp7Y,1107
94
94
  maleo_foundation/utils/__init__.py,sha256=SRPEVoqjZoO6W8rtF_Ti8VIangg6Auwm6eHbZMdOthY,520
95
95
  maleo_foundation/utils/controller.py,sha256=ECzPzpw36zBAjKcWcDbUAhIJGbc6UpeypdUUX6ipXBg,6396
96
- maleo_foundation/utils/exceptions.py,sha256=hstsXST24mbJLuDtAfcdC0FxMgH3IkG97A026CvaX-w,4034
96
+ maleo_foundation/utils/exceptions.py,sha256=YKQ2hwVHUFlLAeup9FmCGptGIgdAuxTmTrD8A3gqURA,4078
97
97
  maleo_foundation/utils/extractor.py,sha256=SZXVYDHWGaA-Dd1BUydwF2HHdZqexEielS4CjL0Ceng,814
98
98
  maleo_foundation/utils/logging.py,sha256=W5Fhk_xAXVqSujaY8mv3hRH4wlQSpUn4ReuMoiKcQa4,7759
99
99
  maleo_foundation/utils/mergers.py,sha256=DniUu3Ot4qkYH_YSw4uD1cn9cfirum4S_Opp8fMkQwA,702
@@ -107,7 +107,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
107
107
  maleo_foundation/utils/loaders/credential/google.py,sha256=deksZXT5wPhEsSMHbZ3x05WHXxCjLDt76Ns-1Tmhp7g,948
108
108
  maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
109
109
  maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
110
- maleo_foundation-0.2.4.dist-info/METADATA,sha256=x_39L6UXFNyvmLxpFW2aqL9dX5A_OC8AK-De7K58Kr0,3418
111
- maleo_foundation-0.2.4.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
112
- maleo_foundation-0.2.4.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
113
- maleo_foundation-0.2.4.dist-info/RECORD,,
110
+ maleo_foundation-0.2.6.dist-info/METADATA,sha256=EXYSeEKvhAUI78D8EMYt4KS7sRUpZ2P-nrMMSnhkmqg,3418
111
+ maleo_foundation-0.2.6.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
112
+ maleo_foundation-0.2.6.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
113
+ maleo_foundation-0.2.6.dist-info/RECORD,,