aiteamutils 0.2.79__py3-none-any.whl → 0.2.80__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.
- aiteamutils/base_repository.py +3 -3
- aiteamutils/base_service.py +1 -19
- aiteamutils/database.py +6 -4
- aiteamutils/exceptions.py +2 -0
- aiteamutils/security.py +4 -4
- aiteamutils/version.py +1 -1
- {aiteamutils-0.2.79.dist-info → aiteamutils-0.2.80.dist-info}/METADATA +1 -1
- aiteamutils-0.2.80.dist-info/RECORD +15 -0
- aiteamutils-0.2.79.dist-info/RECORD +0 -15
- {aiteamutils-0.2.79.dist-info → aiteamutils-0.2.80.dist-info}/WHEEL +0 -0
aiteamutils/base_repository.py
CHANGED
@@ -79,13 +79,13 @@ class BaseRepository(Generic[ModelType]):
|
|
79
79
|
async def delete(
|
80
80
|
self,
|
81
81
|
conditions: Dict[str, Any]
|
82
|
-
) ->
|
82
|
+
) -> bool:
|
83
83
|
await delete_entity(
|
84
84
|
session=self.session,
|
85
85
|
model=self.model,
|
86
86
|
conditions=conditions
|
87
87
|
)
|
88
|
-
|
88
|
+
return True
|
89
89
|
#########################
|
90
90
|
# 조회 및 검색 메서드 #
|
91
91
|
#########################
|
@@ -93,7 +93,7 @@ class BaseRepository(Generic[ModelType]):
|
|
93
93
|
self,
|
94
94
|
skip: int = 0,
|
95
95
|
limit: int = 100,
|
96
|
-
filters: Optional[Dict[str, Any]] = None,
|
96
|
+
filters: Optional[List[Dict[str, Any]]] = None,
|
97
97
|
explicit_joins: Optional[List[Any]] = None,
|
98
98
|
loading_joins: Optional[List[Any]] = None
|
99
99
|
) -> List[ModelType]:
|
aiteamutils/base_service.py
CHANGED
@@ -125,7 +125,7 @@ class BaseService(Generic[ModelType]):
|
|
125
125
|
self,
|
126
126
|
ulid: str | None = None,
|
127
127
|
conditions: Dict[str, Any] | None = None
|
128
|
-
) ->
|
128
|
+
) -> bool:
|
129
129
|
try:
|
130
130
|
if not ULID.from_str(ulid):
|
131
131
|
raise CustomException(
|
@@ -168,29 +168,11 @@ class BaseService(Generic[ModelType]):
|
|
168
168
|
skip: int = 0,
|
169
169
|
limit: int = 100,
|
170
170
|
filters: List[Dict[str, Any]] | None = None,
|
171
|
-
model_name: str | None = None,
|
172
171
|
response_model: Any = None,
|
173
172
|
explicit_joins: Optional[List[Any]] = None,
|
174
173
|
loading_joins: Optional[List[Any]] = None
|
175
174
|
) -> List[Dict[str, Any]]:
|
176
175
|
try:
|
177
|
-
# 모델 이름을 통한 동적 처리
|
178
|
-
if model_name:
|
179
|
-
if model_name not in self.additional_models:
|
180
|
-
raise CustomException(
|
181
|
-
ErrorCode.INVALID_REQUEST,
|
182
|
-
detail=f"Model {model_name} not registered",
|
183
|
-
source_function=f"{self.__class__.__name__}.list"
|
184
|
-
)
|
185
|
-
model = self.additional_models[model_name]
|
186
|
-
entities = await self.repository.list(
|
187
|
-
skip=skip,
|
188
|
-
limit=limit,
|
189
|
-
filters=filters,
|
190
|
-
model=model
|
191
|
-
)
|
192
|
-
return [process_response(entity, response_model) for entity in entities]
|
193
|
-
|
194
176
|
entities = await self.repository.list(
|
195
177
|
skip=skip,
|
196
178
|
limit=limit,
|
aiteamutils/database.py
CHANGED
@@ -364,7 +364,7 @@ async def delete_entity(
|
|
364
364
|
session: AsyncSession,
|
365
365
|
model: Type[ModelType],
|
366
366
|
conditions: Dict[str, Any]
|
367
|
-
) ->
|
367
|
+
) -> bool:
|
368
368
|
try:
|
369
369
|
stmt = select(model)
|
370
370
|
for key, value in conditions.items():
|
@@ -386,6 +386,7 @@ async def delete_entity(
|
|
386
386
|
await session.flush()
|
387
387
|
await session.refresh(entity)
|
388
388
|
|
389
|
+
return True
|
389
390
|
except SQLAlchemyError as e:
|
390
391
|
raise CustomException(
|
391
392
|
ErrorCode.DB_DELETE_ERROR,
|
@@ -398,17 +399,18 @@ async def purge_entity(
|
|
398
399
|
session: AsyncSession,
|
399
400
|
model: Type[ModelType],
|
400
401
|
entity: ModelType
|
401
|
-
) ->
|
402
|
+
) -> bool:
|
402
403
|
# 엔티티를 영구 삭제합니다.
|
403
404
|
await session.delete(entity)
|
404
|
-
|
405
|
+
|
406
|
+
return True
|
405
407
|
|
406
408
|
async def list_entities(
|
407
409
|
session: AsyncSession,
|
408
410
|
model: Type[ModelType],
|
409
411
|
skip: int = 0,
|
410
412
|
limit: int = 100,
|
411
|
-
filters: Optional[Dict[str, Any]] = None,
|
413
|
+
filters: Optional[List[Dict[str, Any]]] = None,
|
412
414
|
explicit_joins: Optional[List[Any]] = None,
|
413
415
|
loading_joins: Optional[List[Any]] = None
|
414
416
|
) -> List[Dict[str, Any]]:
|
aiteamutils/exceptions.py
CHANGED
@@ -74,6 +74,8 @@ class ErrorCode(Enum):
|
|
74
74
|
SERVICE_NOT_REGISTERED = ErrorResponse(5003, "GENERAL_SERVICE_UNAVAILABLE", 503, "서비스를 사용할 수 없습니다")
|
75
75
|
LOGIN_ERROR = ErrorResponse(5004, "LOGIN_ERROR", 401, "로그인 오류")
|
76
76
|
TOKEN_ERROR = ErrorResponse(5005, "TOKEN_ERROR", 401, "토큰 오류")
|
77
|
+
DELETE_ERROR = ErrorResponse(5006, "DELETE_ERROR", 400, "삭제 오류")
|
78
|
+
|
77
79
|
|
78
80
|
class CustomException(Exception):
|
79
81
|
"""사용자 정의 예외 클래스"""
|
aiteamutils/security.py
CHANGED
@@ -162,10 +162,10 @@ async def create_jwt_token(
|
|
162
162
|
"token_type": token_type,
|
163
163
|
|
164
164
|
# 조직 관련 클레임
|
165
|
-
"organization_ulid": user_data.role.organization.ulid,
|
166
|
-
"organization_id": user_data.role.organization.id,
|
167
|
-
"organization_name": user_data.role.organization.name,
|
168
|
-
"company_name": user_data.role.organization.company.name
|
165
|
+
"organization_ulid": user_data.role.team.organization.ulid,
|
166
|
+
"organization_id": user_data.role.team.organization.id,
|
167
|
+
"organization_name": user_data.role.team.organization.name,
|
168
|
+
"company_name": user_data.role.team.organization.company.name
|
169
169
|
}
|
170
170
|
else: # refresh token
|
171
171
|
expires_at = datetime.now(timezone.utc) + timedelta(days=14)
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.80"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
aiteamutils/__init__.py,sha256=kRBpRjark0M8ZwFfmKiMFol6CbIILN3WE4f6_P6iIq0,1089
|
2
|
+
aiteamutils/base_model.py,sha256=bnRJJaGXGS3TKxfCWWV3arFjdG0qLsPFDXuguYsDyVM,3008
|
3
|
+
aiteamutils/base_repository.py,sha256=-5kPNsB82ILj_Z9Hdf2tVxSb7owars1KBgDubIRXA7I,4430
|
4
|
+
aiteamutils/base_service.py,sha256=6wCEbxPj9idhvMJbE3EK1uhXf5On97JVz2IFF-MILrw,8330
|
5
|
+
aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
|
6
|
+
aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
|
7
|
+
aiteamutils/database.py,sha256=HezCvPVVFV2qyZOkuyy92z1g3bKBgwAnksZQVHuwYyw,19220
|
8
|
+
aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
|
9
|
+
aiteamutils/exceptions.py,sha256=5yREcEUbJPzq2404pFJ4J9047I9_qx2QG5iBND1PjDI,15901
|
10
|
+
aiteamutils/security.py,sha256=JA7QGO07Jfmiwu3u429gIX6f8ESc3wQ4GeyOetLbHEo,9681
|
11
|
+
aiteamutils/validators.py,sha256=PvI9hbMEAqTawgxPbiWRyx2r9yTUrpNBQs1AD3w4F2U,7726
|
12
|
+
aiteamutils/version.py,sha256=x9TYUs6I03uAB9NABtV3lwAjzbxNdHWdUxFrj6Xcfgg,42
|
13
|
+
aiteamutils-0.2.80.dist-info/METADATA,sha256=ueFgVZRnNCHfe4Db8g0Is9NYOuAU44NUmlcRQa7aqz8,1718
|
14
|
+
aiteamutils-0.2.80.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
aiteamutils-0.2.80.dist-info/RECORD,,
|
@@ -1,15 +0,0 @@
|
|
1
|
-
aiteamutils/__init__.py,sha256=kRBpRjark0M8ZwFfmKiMFol6CbIILN3WE4f6_P6iIq0,1089
|
2
|
-
aiteamutils/base_model.py,sha256=bnRJJaGXGS3TKxfCWWV3arFjdG0qLsPFDXuguYsDyVM,3008
|
3
|
-
aiteamutils/base_repository.py,sha256=VLCLLVkNnYLmZ6EMcr3Tu0RkMqDyMhtCO3M_2j6q-R8,4409
|
4
|
-
aiteamutils/base_service.py,sha256=GmO_fqrSEbIs_Jc5BoRBTLfaJaS6CIxYPAs4B4TdtaU,9123
|
5
|
-
aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
|
6
|
-
aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
|
7
|
-
aiteamutils/database.py,sha256=Q2rwVfhS8Rpnj89EwtcLtmsDpANkJ1AlprlqQsgIQAg,19204
|
8
|
-
aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
|
9
|
-
aiteamutils/exceptions.py,sha256=3FUCIqXgYmMqonnMgUlh-J2xtApiiCgg4WM-2UV4vmQ,15823
|
10
|
-
aiteamutils/security.py,sha256=dPprEiKZ_VCg9bf27OaBvWw5SMBb_V0KGajIbgIbejs,9661
|
11
|
-
aiteamutils/validators.py,sha256=PvI9hbMEAqTawgxPbiWRyx2r9yTUrpNBQs1AD3w4F2U,7726
|
12
|
-
aiteamutils/version.py,sha256=CzBQOXpe_-RfEDV4RvVHykuSQFo8eYW1g0gu7UOhJ-E,42
|
13
|
-
aiteamutils-0.2.79.dist-info/METADATA,sha256=pQkGcF9V5M-cOJKyAYJsCYyYe5DnCDQhmqh36G30vb4,1718
|
14
|
-
aiteamutils-0.2.79.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
-
aiteamutils-0.2.79.dist-info/RECORD,,
|
File without changes
|