maleo-foundation 0.2.28__py3-none-any.whl → 0.2.29__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.
- maleo_foundation/utils/repository.py +15 -9
- {maleo_foundation-0.2.28.dist-info → maleo_foundation-0.2.29.dist-info}/METADATA +1 -1
- {maleo_foundation-0.2.28.dist-info → maleo_foundation-0.2.29.dist-info}/RECORD +5 -5
- {maleo_foundation-0.2.28.dist-info → maleo_foundation-0.2.29.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.2.28.dist-info → maleo_foundation-0.2.29.dist-info}/top_level.txt +0 -0
@@ -9,6 +9,7 @@ from maleo_foundation.models.transfers.results.service.repository import \
|
|
9
9
|
class BaseRepositoryUtils:
|
10
10
|
@staticmethod
|
11
11
|
def result_processor(
|
12
|
+
fail_class:Type[BaseServiceRepositoryResultsTransfers.Fail],
|
12
13
|
data_found_class:Union[
|
13
14
|
Type[BaseServiceRepositoryResultsTransfers.SingleData],
|
14
15
|
Type[BaseServiceRepositoryResultsTransfers.UnpaginatedMultipleData],
|
@@ -19,17 +20,22 @@ class BaseRepositoryUtils:
|
|
19
20
|
"""Decorator to handle repository-related exceptions consistently."""
|
20
21
|
def decorator(func):
|
21
22
|
def _processor(result:BaseTypes.StringToAnyDict):
|
22
|
-
if "data" not in result:
|
23
|
-
raise ValueError("Result did not have 'data' field")
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
validated_result = no_data_class.model_validate(result)
|
23
|
+
if "success" not in result and "data" not in result:
|
24
|
+
raise ValueError("Result did not have both 'success' and 'data' field")
|
25
|
+
success:bool = result.get("success")
|
26
|
+
data:BaseTypes.StringToAnyDict = result.get("data")
|
27
|
+
if not success:
|
28
|
+
validated_result = fail_class.model_validate(result)
|
29
29
|
return validated_result
|
30
30
|
else:
|
31
|
-
|
32
|
-
|
31
|
+
if data is None:
|
32
|
+
if no_data_class is None:
|
33
|
+
raise ValueError("'no_data_class' must be given to validate No Data")
|
34
|
+
validated_result = no_data_class.model_validate(result)
|
35
|
+
return validated_result
|
36
|
+
else:
|
37
|
+
validated_result = data_found_class.model_validate(result)
|
38
|
+
return validated_result
|
33
39
|
if asyncio.iscoroutinefunction(func):
|
34
40
|
@wraps(func)
|
35
41
|
async def async_wrapper(*args, **kwargs):
|
@@ -103,7 +103,7 @@ maleo_foundation/utils/extractor.py,sha256=SZXVYDHWGaA-Dd1BUydwF2HHdZqexEielS4Cj
|
|
103
103
|
maleo_foundation/utils/logging.py,sha256=W5Fhk_xAXVqSujaY8mv3hRH4wlQSpUn4ReuMoiKcQa4,7759
|
104
104
|
maleo_foundation/utils/mergers.py,sha256=DniUu3Ot4qkYH_YSw4uD1cn9cfirum4S_Opp8fMkQwA,702
|
105
105
|
maleo_foundation/utils/query.py,sha256=OQJNf42XeIh-J6tBa_f8iX-UoAib1vg_z8LsVE3zfGk,4739
|
106
|
-
maleo_foundation/utils/repository.py,sha256=
|
106
|
+
maleo_foundation/utils/repository.py,sha256=knBi3xOLlhBIEtChvqbZh4wXmgrFCB3rDwQXy41d7_c,2852
|
107
107
|
maleo_foundation/utils/dependencies/__init__.py,sha256=0KKGrdfj8Cc5A4SRk_ZBAxzOP795Mizdb4zIBh07KC4,122
|
108
108
|
maleo_foundation/utils/dependencies/auth.py,sha256=wS9qnmd1n2WsFhiSfyq_3Io3wwZKTENVPv4rMwxJslE,727
|
109
109
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
@@ -115,7 +115,7 @@ maleo_foundation/utils/loaders/credential/__init__.py,sha256=qopTKvcMVoTFwyRijeg
|
|
115
115
|
maleo_foundation/utils/loaders/credential/google.py,sha256=SKsqPuFnAiCcYLf24CxKnMybhVHpgqnq1gGSlThqjts,994
|
116
116
|
maleo_foundation/utils/loaders/key/__init__.py,sha256=hVygcC2ImHc_aVrSrOmyedR8tMUZokWUKCKOSh5ctbo,106
|
117
117
|
maleo_foundation/utils/loaders/key/rsa.py,sha256=gDhyX6iTFtHiluuhFCozaZ3pOLKU2Y9TlrNMK_GVyGU,3796
|
118
|
-
maleo_foundation-0.2.
|
119
|
-
maleo_foundation-0.2.
|
120
|
-
maleo_foundation-0.2.
|
121
|
-
maleo_foundation-0.2.
|
118
|
+
maleo_foundation-0.2.29.dist-info/METADATA,sha256=ZG11XRzhr1N5hPhR90vt7vS64gYUWzGGiirT_HQB4rk,3598
|
119
|
+
maleo_foundation-0.2.29.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
120
|
+
maleo_foundation-0.2.29.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
121
|
+
maleo_foundation-0.2.29.dist-info/RECORD,,
|
File without changes
|
File without changes
|