maleo-foundation 0.2.12__tar.gz → 0.2.14__tar.gz

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.
Files changed (121) hide show
  1. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/PKG-INFO +1 -1
  2. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/client.py +17 -16
  3. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/service.py +4 -32
  4. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/controller.py +1 -46
  5. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation.egg-info/PKG-INFO +1 -1
  6. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/pyproject.toml +1 -1
  7. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/README.md +0 -0
  8. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/__init__.py +0 -0
  9. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/authentication.py +0 -0
  10. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/authorization.py +0 -0
  11. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/__init__.py +0 -0
  12. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/manager.py +0 -0
  13. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/__init__.py +0 -0
  14. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/encryption/__init__.py +0 -0
  15. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/encryption/aes.py +0 -0
  16. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/encryption/rsa.py +0 -0
  17. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/hash/__init__.py +0 -0
  18. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/hash/bcrypt.py +0 -0
  19. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/hash/hmac.py +0 -0
  20. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/hash/sha256.py +0 -0
  21. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/key.py +0 -0
  22. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/signature.py +0 -0
  23. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/client/services/token.py +0 -0
  24. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/constants.py +0 -0
  25. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/enums.py +0 -0
  26. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/__init__.py +0 -0
  27. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/client.py +0 -0
  28. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/encryption/__init__.py +0 -0
  29. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/encryption/aes.py +0 -0
  30. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/encryption/rsa.py +0 -0
  31. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/general.py +0 -0
  32. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/hash.py +0 -0
  33. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/key.py +0 -0
  34. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/query.py +0 -0
  35. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/service.py +0 -0
  36. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/signature.py +0 -0
  37. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/expanded_types/token.py +0 -0
  38. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/extended_types.py +0 -0
  39. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/__init__.py +0 -0
  40. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/client/__init__.py +0 -0
  41. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/client/base.py +0 -0
  42. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/client/google/__init__.py +0 -0
  43. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/client/google/base.py +0 -0
  44. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/client/google/secret.py +0 -0
  45. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/client/google/storage.py +0 -0
  46. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/client/maleo.py +0 -0
  47. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/db.py +0 -0
  48. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/middleware.py +0 -0
  49. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/managers/service.py +0 -0
  50. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/middlewares/authentication.py +0 -0
  51. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/middlewares/base.py +0 -0
  52. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/middlewares/cors.py +0 -0
  53. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/__init__.py +0 -0
  54. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/responses.py +0 -0
  55. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/__init__.py +0 -0
  56. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/encryption.py +0 -0
  57. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/general.py +0 -0
  58. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/hash.py +0 -0
  59. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/key.py +0 -0
  60. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/parameter.py +0 -0
  61. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/result.py +0 -0
  62. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/signature.py +0 -0
  63. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/schemas/token.py +0 -0
  64. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/table.py +0 -0
  65. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/__init__.py +0 -0
  66. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/general/__init__.py +0 -0
  67. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/general/key.py +0 -0
  68. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/general/signature.py +0 -0
  69. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/general/token.py +0 -0
  70. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
  71. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/encryption/__init__.py +0 -0
  72. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/encryption/aes.py +0 -0
  73. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/encryption/rsa.py +0 -0
  74. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/general.py +0 -0
  75. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/hash/__init__.py +0 -0
  76. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/hash/bcrypt.py +0 -0
  77. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/hash/hmac.py +0 -0
  78. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/hash/sha256.py +0 -0
  79. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/key.py +0 -0
  80. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/signature.py +0 -0
  81. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/parameters/token.py +0 -0
  82. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/__init__.py +0 -0
  83. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
  84. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
  85. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
  86. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/client/service.py +0 -0
  87. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/encryption/__init__.py +0 -0
  88. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/encryption/aes.py +0 -0
  89. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/encryption/rsa.py +0 -0
  90. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/hash.py +0 -0
  91. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/key.py +0 -0
  92. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
  93. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
  94. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
  95. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/service/general.py +0 -0
  96. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/service/query.py +0 -0
  97. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/signature.py +0 -0
  98. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/models/transfers/results/token.py +0 -0
  99. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/types.py +0 -0
  100. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/__init__.py +0 -0
  101. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/dependencies/__init__.py +0 -0
  102. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/dependencies/auth.py +0 -0
  103. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/exceptions.py +0 -0
  104. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/extractor.py +0 -0
  105. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/formatter/__init__.py +0 -0
  106. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/formatter/case.py +0 -0
  107. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/loaders/__init__.py +0 -0
  108. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/loaders/credential/__init__.py +0 -0
  109. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/loaders/credential/google.py +0 -0
  110. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/loaders/json.py +0 -0
  111. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/loaders/key/__init__.py +0 -0
  112. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/loaders/key/rsa.py +0 -0
  113. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/loaders/yaml.py +0 -0
  114. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/logging.py +0 -0
  115. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/mergers.py +0 -0
  116. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation/utils/query.py +0 -0
  117. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation.egg-info/SOURCES.txt +0 -0
  118. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation.egg-info/dependency_links.txt +0 -0
  119. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation.egg-info/requires.txt +0 -0
  120. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/maleo_foundation.egg-info/top_level.txt +0 -0
  121. {maleo_foundation-0.2.12 → maleo_foundation-0.2.14}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.2.12
3
+ Version: 0.2.14
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -10,8 +10,7 @@ class BaseClientParametersTransfers:
10
10
  BaseParameterSchemas.SortColumns,
11
11
  BaseGeneralSchemas.Search,
12
12
  BaseGeneralSchemas.Statuses,
13
- BaseParameterSchemas.DateFilters,
14
- BaseGeneralSchemas.Ids,
13
+ BaseParameterSchemas.DateFilters
15
14
  ):
16
15
  pass
17
16
 
@@ -51,15 +50,16 @@ class BaseClientParametersTransfers:
51
50
  self.filters = filter
52
51
 
53
52
  return self
54
-
55
- def to_query_params(self) -> dict[str, Any]:
56
- params = {
53
+
54
+ @property
55
+ def query_params(self) -> dict[str, Any]:
56
+ raw_params = {
57
+ "filters": self.filters,
58
+ "statuses": self.statuses,
57
59
  "search": self.search,
58
60
  "sorts": self.sorts,
59
- "filters": self.filters,
60
61
  }
61
- if hasattr(self, "statuses") and self.statuses is not None:
62
- params["statuses"] = self.statuses
62
+ params = {k: v for k, v in raw_params.items() if v not in (None, [], "")}
63
63
  return params
64
64
 
65
65
  class GetPaginatedMultiple(
@@ -104,15 +104,16 @@ class BaseClientParametersTransfers:
104
104
  self.filters = filter
105
105
 
106
106
  return self
107
-
108
- def to_query_params(self) -> dict[str, Any]:
109
- params = {
110
- "page": self.page,
111
- "limit": self.limit,
107
+
108
+ @property
109
+ def query_params(self) -> dict[str, Any]:
110
+ raw_params = {
111
+ "filters": self.filters,
112
+ "statuses": self.statuses,
112
113
  "search": self.search,
113
114
  "sorts": self.sorts,
114
- "filters": self.filters,
115
+ "page": self.page,
116
+ "limit": self.limit
115
117
  }
116
- if hasattr(self, "statuses") and self.statuses is not None:
117
- params["statuses"] = self.statuses
118
+ params = {k: v for k, v in raw_params.items() if v not in (None, [], "")}
118
119
  return params
@@ -1,19 +1,17 @@
1
1
  from __future__ import annotations
2
2
  from datetime import datetime
3
- from pydantic import BaseModel, Field, model_validator
4
- from typing import Optional, Self
3
+ from pydantic import model_validator
4
+ from typing import Self
5
5
  from maleo_foundation.enums import BaseEnums
6
6
  from maleo_foundation.models.schemas.general import BaseGeneralSchemas
7
7
  from maleo_foundation.models.schemas.parameter import BaseParameterSchemas
8
- from maleo_foundation.types import BaseTypes
9
8
 
10
9
  class BaseServiceParametersTransfers:
11
10
  class GetUnpaginatedMultipleQuery(
12
11
  BaseParameterSchemas.Sorts,
13
12
  BaseGeneralSchemas.Search,
14
13
  BaseGeneralSchemas.Statuses,
15
- BaseParameterSchemas.Filters,
16
- BaseGeneralSchemas.Ids
14
+ BaseParameterSchemas.Filters
17
15
  ): pass
18
16
 
19
17
  class GetUnpaginatedMultiple(
@@ -131,30 +129,4 @@ class BaseServiceParametersTransfers:
131
129
 
132
130
  #* Update date_filters
133
131
  self.date_filters = date_filters
134
- return self
135
-
136
- class UniqueFieldCheck(BaseModel):
137
- operation:BaseEnums.OperationType = Field(..., description="Operation to be conducted")
138
- field:BaseEnums.IdentifierTypes = Field(..., description="Field to be checked")
139
- new_value:BaseTypes.OptionalAny = Field(..., description="New field's value")
140
- old_value:BaseTypes.OptionalAny = Field(None, description="Old field's value")
141
- nullable:bool = Field(False, description="Whether to allow null field's value")
142
- suggestion:BaseTypes.OptionalString = Field(None, description="Suggestion on discrepancy")
143
-
144
- UniqueFieldChecks = list[UniqueFieldCheck]
145
-
146
- status_update_criterias:dict[
147
- BaseEnums.StatusUpdateAction,
148
- Optional[list[BaseEnums.StatusType]]
149
- ] = {
150
- BaseEnums.StatusUpdateAction.DELETE: None,
151
- BaseEnums.StatusUpdateAction.RESTORE: None,
152
- BaseEnums.StatusUpdateAction.DEACTIVATE: [
153
- BaseEnums.StatusType.INACTIVE,
154
- BaseEnums.StatusType.ACTIVE,
155
- ],
156
- BaseEnums.StatusUpdateAction.ACTIVATE: [
157
- BaseEnums.StatusType.INACTIVE,
158
- BaseEnums.StatusType.ACTIVE,
159
- ]
160
- }
132
+ return self
@@ -1,58 +1,13 @@
1
1
  from fastapi import status
2
2
  from functools import wraps
3
- from typing import Awaitable, Callable, Dict, List, Type, Any
3
+ from typing import Awaitable, Callable, Dict, List
4
4
  from maleo_foundation.types import BaseTypes
5
- from maleo_foundation.enums import BaseEnums
6
5
  from maleo_foundation.models.responses import BaseResponses
7
6
  from maleo_foundation.models.transfers.parameters.general import BaseGeneralParametersTransfers
8
- from maleo_foundation.models.transfers.parameters.service import BaseServiceParametersTransfers
9
7
  from maleo_foundation.models.transfers.results.service.controllers.rest import BaseServiceRESTControllerResults
10
8
  from maleo_foundation.expanded_types.general import BaseGeneralExpandedTypes
11
- from maleo_foundation.expanded_types.service import ExpandedServiceTypes
12
9
 
13
10
  class BaseControllerUtils:
14
- @staticmethod
15
- def check_unique_existence(
16
- check:BaseServiceParametersTransfers.UniqueFieldCheck,
17
- get_single_parameters_class:Type[ExpandedServiceTypes.GetSingleParameter],
18
- get_single_service_function:ExpandedServiceTypes.SyncGetSingleFunction,
19
- create_failed_response_class:Type[BaseResponses.Fail],
20
- update_failed_response_class:Type[BaseResponses.Fail],
21
- **additional_get_parameters:Any
22
- ) -> BaseServiceRESTControllerResults:
23
- """Generic helper function to check if a unique value exists in the database."""
24
-
25
- #* Return early if nullable and no new value
26
- if check.nullable and check.new_value is None:
27
- return BaseServiceRESTControllerResults(success=True, content=None)
28
-
29
- #* Return early if values are unchanged on update
30
- if check.operation == BaseEnums.OperationType.UPDATE and check.old_value == check.new_value:
31
- return BaseServiceRESTControllerResults(success=True, content=None)
32
-
33
- #* Prepare parameters to query for existing data
34
- get_single_parameters = get_single_parameters_class(identifier=check.field, value=check.new_value)
35
-
36
- #* Query the existing data using provided function
37
- service_result:ExpandedServiceTypes.GetSingleResult = get_single_service_function(parameters=get_single_parameters, **additional_get_parameters)
38
- if not service_result.success:
39
- content = BaseResponses.ServerError.model_validate(service_result.model_dump(exclude_unset=True)).model_dump()
40
- return BaseServiceRESTControllerResults(success=False, content=content, status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
41
-
42
- #* Handle case if duplicate is found
43
- if service_result.data:
44
- description = f"External error: {check.field} of '{check.new_value}' already exists in the database"
45
- other = check.suggestion or f"Select another {check.field} value"
46
- if check.operation == BaseEnums.OperationType.CREATE:
47
- content = create_failed_response_class(description=description, other=other).model_dump()
48
- elif check.operation == BaseEnums.OperationType.UPDATE:
49
- content = update_failed_response_class(description=description, other=other).model_dump()
50
-
51
- return BaseServiceRESTControllerResults(success=False, content=content, status_code=status.HTTP_400_BAD_REQUEST)
52
-
53
- #* No duplicates found
54
- return BaseServiceRESTControllerResults(success=True, content=None)
55
-
56
11
  @staticmethod
57
12
  def field_expansion_handler(
58
13
  expandable_fields_dependencies_map:BaseTypes.OptionalStringToListOfStringDict = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.2.12
3
+ Version: 0.2.14
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maleo_foundation"
7
- version = "0.2.12"
7
+ version = "0.2.14"
8
8
  description = "Foundation package for Maleo"
9
9
  authors = [
10
10
  { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }