maleo-foundation 0.2.5__py3-none-any.whl → 0.2.7__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.
@@ -30,6 +30,11 @@ class BaseResponses:
30
30
  message:str = "Forbidden Request"
31
31
  description:str = "You are forbidden from requesting this resource"
32
32
 
33
+ class MethodNotAllowed(Fail):
34
+ code:str = "MAL-MTA-002"
35
+ message:str = "Method Not Allowed"
36
+ description:str = "Method not allowed for requesting this resource"
37
+
33
38
  class ValidationError(Fail):
34
39
  code:str = "MAL-VLD-001"
35
40
  message:str = "Validation Error"
@@ -100,6 +105,10 @@ class BaseResponses:
100
105
  "description": "Not Found Response",
101
106
  "model": NotFound
102
107
  },
108
+ status.HTTP_405_METHOD_NOT_ALLOWED: {
109
+ "description": "Method Not Allowed Response",
110
+ "model": MethodNotAllowed
111
+ },
103
112
  status.HTTP_422_UNPROCESSABLE_ENTITY: {
104
113
  "description": "Validation Error Response",
105
114
  "model": ValidationError
@@ -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.5
3
+ Version: 0.2.7
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -44,7 +44,7 @@ maleo_foundation/middlewares/authentication.py,sha256=hBGaMiCt0CnUw7sg4PZJ3kFJ0O
44
44
  maleo_foundation/middlewares/base.py,sha256=g4cg9gIUveK9zbjhwQtkdefhuoSlv9BUWVCFaSlOClw,13303
45
45
  maleo_foundation/middlewares/cors.py,sha256=9uvBvY2N6Vxa9RP_YtESxcWo6Doi6uS0lzAG9iLY7Uc,2288
46
46
  maleo_foundation/models/__init__.py,sha256=AaKehO7c1HyKhoTGRmNHDddSeBXkW-_YNrpOGBu8Ms8,246
47
- maleo_foundation/models/responses.py,sha256=7IxPEP5UkqA5_RDJndT-reEZMk_vhyryjph1ZbtiSrs,4556
47
+ maleo_foundation/models/responses.py,sha256=iKJs9EFemCuUOc-IxEUwjX9RgNnPf-mw7yGheCGyVDA,4896
48
48
  maleo_foundation/models/table.py,sha256=Dk5GXeO0gbBBPN2PJtZhlUx2x3vMbT4dxTBc3YLBbuc,1199
49
49
  maleo_foundation/models/schemas/__init__.py,sha256=Xj8Ahsqyra-fmEaVcGPok5GOOsPQlKcknHYMvbjvENA,277
50
50
  maleo_foundation/models/schemas/encryption.py,sha256=KYs2P57AqWpEROuqTuSuyt1Zk-jsIUKFeRWIfSwem74,658
@@ -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.5.dist-info/METADATA,sha256=pV3QopFDva0YAQo7fJjcA6x1ndS-EsLiw1Y-ulqSw2A,3418
111
- maleo_foundation-0.2.5.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
112
- maleo_foundation-0.2.5.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
113
- maleo_foundation-0.2.5.dist-info/RECORD,,
110
+ maleo_foundation-0.2.7.dist-info/METADATA,sha256=VMS1nmB6vuioBkMlZiflqejZ9d0jPbvldXzjNM3HdCA,3418
111
+ maleo_foundation-0.2.7.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
112
+ maleo_foundation-0.2.7.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
113
+ maleo_foundation-0.2.7.dist-info/RECORD,,