aiteamutils 0.2.63__tar.gz → 0.2.65__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/PKG-INFO +1 -1
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/base_repository.py +0 -13
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/base_service.py +5 -18
- aiteamutils-0.2.65/aiteamutils/version.py +2 -0
- aiteamutils-0.2.63/aiteamutils/version.py +0 -2
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/.cursorrules +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/.gitignore +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/README.md +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/__init__.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/base_model.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/cache.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/config.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/database.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/enums.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/exceptions.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/security.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/aiteamutils/validators.py +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/pyproject.toml +0 -0
- {aiteamutils-0.2.63 → aiteamutils-0.2.65}/setup.py +0 -0
@@ -13,19 +13,6 @@ ModelType = TypeVar("ModelType", bound=DeclarativeBase)
|
|
13
13
|
|
14
14
|
class BaseRepository(Generic[ModelType]):
|
15
15
|
def __init__(self, session: AsyncSession, model: Type[ModelType]):
|
16
|
-
if session is None:
|
17
|
-
raise CustomException(
|
18
|
-
ErrorCode.DB_CONNECTION_ERROR,
|
19
|
-
detail="Database session is not set",
|
20
|
-
source_function=f"{self.__class__.__name__}.session"
|
21
|
-
)
|
22
|
-
if model is None:
|
23
|
-
raise CustomException(
|
24
|
-
ErrorCode.DB_CONNECTION_ERROR,
|
25
|
-
detail="Model is not set",
|
26
|
-
source_function=f"{self.__class__.__name__}.model"
|
27
|
-
)
|
28
|
-
|
29
16
|
self._session = session
|
30
17
|
self.model = model
|
31
18
|
|
@@ -18,28 +18,13 @@ class BaseService(Generic[ModelType]):
|
|
18
18
|
self,
|
19
19
|
model: Type[ModelType],
|
20
20
|
repository: BaseRepository[ModelType],
|
21
|
-
db_session: AsyncSession
|
21
|
+
db_session: AsyncSession,
|
22
|
+
additional_models: Dict[str, Type[DeclarativeBase]] = None,
|
22
23
|
):
|
23
|
-
if not repository:
|
24
|
-
raise CustomException(
|
25
|
-
ErrorCode.INVALID_REQUEST,
|
26
|
-
detail="Repository is not set",
|
27
|
-
source_function=f"{self.__class__.__name__}.__init__"
|
28
|
-
)
|
29
|
-
if not db_session:
|
30
|
-
raise CustomException(
|
31
|
-
ErrorCode.INVALID_REQUEST,
|
32
|
-
detail="Database session is not set",
|
33
|
-
source_function=f"{self.__class__.__name__}.__init__"
|
34
|
-
)
|
35
|
-
print(f"BaseService.__init__() called with repository: {repository} and db_session: {db_session}")
|
36
|
-
|
37
|
-
|
38
24
|
self.model = model
|
39
25
|
self.repository = repository
|
40
26
|
self.db_session = db_session
|
41
|
-
|
42
|
-
print(f"BaseService initialized with repository: {repository} and db_session: {db_session}")
|
27
|
+
self.additional_models = additional_models or {},
|
43
28
|
|
44
29
|
async def list(
|
45
30
|
self,
|
@@ -48,6 +33,8 @@ class BaseService(Generic[ModelType]):
|
|
48
33
|
filters: Dict[str, Any] | None = None,
|
49
34
|
search_params: Dict[str, Any] | None = None,
|
50
35
|
model_name: str | None = None,
|
36
|
+
request: Request | None = None,
|
37
|
+
response_model: Any = None
|
51
38
|
) -> List[Dict[str, Any]]:
|
52
39
|
try:
|
53
40
|
# 모델 이름을 통한 동적 처리
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|