maleo-foundation 0.2.22__py3-none-any.whl → 0.2.24__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/enums.py CHANGED
@@ -83,11 +83,13 @@ class BaseEnums:
83
83
  AUTHENTICATION = "authentication"
84
84
 
85
85
  class ServiceLoggerType(StrEnum):
86
+ REPOSITORY = "repository"
86
87
  DATABASE = "database"
87
88
  APPLICATION = "application"
88
89
 
89
90
  class LoggerType(StrEnum):
90
91
  MIDDLEWARE = "middleware"
92
+ REPOSITORY = "repository"
91
93
  DATABASE = "database"
92
94
  APPLICATION = "application"
93
95
  CLIENT = "client"
@@ -103,7 +105,8 @@ class BaseEnums:
103
105
  NOTSET = logging.NOTSET
104
106
 
105
107
  class CacheType(StrEnum):
106
- SERVICE = "service"
108
+ REPOSITORY = "repository"
109
+ ROUTER = "router"
107
110
  CLIENT = "client"
108
111
 
109
112
  class CacheTTL(IntEnum):
@@ -129,6 +129,7 @@ class Configurations(BaseModel):
129
129
 
130
130
  class Loggers(BaseModel):
131
131
  application:ServiceLogger = Field(..., description="Application logger")
132
+ repository:ServiceLogger = Field(..., description="Repository logger")
132
133
  database:ServiceLogger = Field(..., description="Database logger")
133
134
  middleware:MiddlewareLoggers = Field(..., description="Middleware logger")
134
135
 
@@ -297,6 +298,11 @@ class ServiceManager:
297
298
  service_key=self._configs.service.key,
298
299
  **self._log_config.model_dump()
299
300
  )
301
+ repository = ServiceLogger(
302
+ type=BaseEnums.LoggerType.REPOSITORY,
303
+ service_key=self._configs.service.key,
304
+ **self._log_config.model_dump()
305
+ )
300
306
  #* Middleware's loggers
301
307
  base = MiddlewareLogger(
302
308
  middleware_type=BaseEnums.MiddlewareLoggerType.BASE,
@@ -311,6 +317,7 @@ class ServiceManager:
311
317
  middleware = MiddlewareLoggers(base=base, authentication=authentication)
312
318
  self._loggers = Loggers(
313
319
  application=application,
320
+ repository=repository,
314
321
  database=database,
315
322
  middleware=middleware
316
323
  )
@@ -9,7 +9,6 @@ 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],
13
12
  data_found_class:Union[
14
13
  Type[BaseServiceRepositoryResultsTransfers.SingleData],
15
14
  Type[BaseServiceRepositoryResultsTransfers.UnpaginatedMultipleData],
@@ -20,22 +19,17 @@ class BaseRepositoryUtils:
20
19
  """Decorator to handle repository-related exceptions consistently."""
21
20
  def decorator(func):
22
21
  def _processor(result:BaseTypes.StringToAnyDict):
23
- if "success" not in result or "data" not in result:
24
- raise ValueError("Result did not have both 'success' and 'data' field")
25
- success = result.get("success")
22
+ if "data" not in result:
23
+ raise ValueError("Result did not have 'data' field")
26
24
  data = result.get("data")
27
- if success is False:
28
- validated_result = fail_class.model_validate(result)
25
+ if data is None:
26
+ if no_data_class is None:
27
+ raise ValueError("'no_data_class' must be given to validate No Data")
28
+ validated_result = no_data_class.model_validate(result)
29
+ return validated_result
30
+ else:
31
+ validated_result = data_found_class.model_validate(result)
29
32
  return validated_result
30
- if success is True:
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
39
33
  if asyncio.iscoroutinefunction(func):
40
34
  @wraps(func)
41
35
  async def async_wrapper(*args, **kwargs):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.2.22
3
+ Version: 0.2.24
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -2,7 +2,7 @@ maleo_foundation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
2
2
  maleo_foundation/authentication.py,sha256=kJfuRKgQY5cjmn0r36z4a4jF4bg7UifZ9D9mgMMnTsw,1840
3
3
  maleo_foundation/authorization.py,sha256=euq24UEhTaimmM24Ies-kZF1zqVwM_x0Zox_6k7zyqI,281
4
4
  maleo_foundation/constants.py,sha256=aBmEfWlBqZxi0k-n6h2NM1YRLOjMnheEiLyQcjP-zCQ,1164
5
- maleo_foundation/enums.py,sha256=FbcODyB91xoACRr48tXwZS5tU1IGiwvKCmWGm1mRu7A,3459
5
+ maleo_foundation/enums.py,sha256=SQKrX4nHuVocMixgOxqy1Z3Rrf7t7aPu9nf6pk7xzEk,3559
6
6
  maleo_foundation/extended_types.py,sha256=pIKt-_9tby4rmune3fmWcCW_mohaNRh_1lywBmdc-L4,301
7
7
  maleo_foundation/types.py,sha256=aKXnIgEhYGSfFqNMGLc4qIKGkINBRpkOo9R9cb2CbwI,2414
8
8
  maleo_foundation/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -33,7 +33,7 @@ maleo_foundation/expanded_types/encryption/rsa.py,sha256=Esf_H8nMz2kOLAWa3M7dlD-
33
33
  maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  maleo_foundation/managers/db.py,sha256=cpY1IOiUytT9XXYtzS0E9OSYOuB7jBKo0XHe__uI1Jg,5340
35
35
  maleo_foundation/managers/middleware.py,sha256=ODIQU1Hpu-Xempjjo_VRbVtxiD5oi74mNuoWuDawRh0,4250
36
- maleo_foundation/managers/service.py,sha256=4H-eEayFEA1aWUYCgSu2sOy4MLDN9RqkCj5xJXN154o,18690
36
+ maleo_foundation/managers/service.py,sha256=i__-ISJ9YQi08nMRl6_j8jOVJB--A-tpGwWPF3FvoqM,18991
37
37
  maleo_foundation/managers/cache/__init__.py,sha256=CeY0oof2bVl_v5WS-FKXNwn2gf3xrEMfUsHK9cHo59s,471
38
38
  maleo_foundation/managers/cache/redis.py,sha256=vUpQUAKP_wZb_Fr1wEzICDCPQyBW8jnZ-pktl6AIdmY,1021
39
39
  maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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=CbT1teeJSXEKcws8K_xQbjGphRyrbItPKN1omHo_wew,2839
106
+ maleo_foundation/utils/repository.py,sha256=n9eGpFybisXb0LVmNDZi2JJ61Urma5QqK6MhDOHcqfI,2454
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.22.dist-info/METADATA,sha256=V-ujMe7QeV7cRbzPl7TLrkuzRKrP0X5ujl9iibWxBWI,3598
119
- maleo_foundation-0.2.22.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
120
- maleo_foundation-0.2.22.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
121
- maleo_foundation-0.2.22.dist-info/RECORD,,
118
+ maleo_foundation-0.2.24.dist-info/METADATA,sha256=TSu32C-FotlV06Xf7GsaGSrw6yQjC-g8Q2_DP_NyFaw,3598
119
+ maleo_foundation-0.2.24.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
120
+ maleo_foundation-0.2.24.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
121
+ maleo_foundation-0.2.24.dist-info/RECORD,,