aiteamutils 0.2.56__py3-none-any.whl → 0.2.57__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/dependencies.py
CHANGED
@@ -15,6 +15,16 @@ T = TypeVar("T", bound=BaseService)
|
|
15
15
|
R = TypeVar("R", bound=BaseRepository)
|
16
16
|
|
17
17
|
_service_registry: Dict[str, Dict[str, Any]] = {}
|
18
|
+
_session_provider = None
|
19
|
+
|
20
|
+
def setup_dependencies(session_provider: Callable[[], AsyncGenerator[AsyncSession, None]]) -> None:
|
21
|
+
"""의존성 설정을 초기화합니다.
|
22
|
+
|
23
|
+
Args:
|
24
|
+
session_provider: 데이터베이스 세션을 제공하는 함수
|
25
|
+
"""
|
26
|
+
global _session_provider
|
27
|
+
_session_provider = session_provider
|
18
28
|
|
19
29
|
def register_service(
|
20
30
|
service_class: Type[T],
|
@@ -28,6 +38,13 @@ def register_service(
|
|
28
38
|
repository_class: 저장소 클래스 (선택)
|
29
39
|
**kwargs: 추가 의존성
|
30
40
|
"""
|
41
|
+
if _session_provider is None:
|
42
|
+
raise CustomException(
|
43
|
+
ErrorCode.INTERNAL_ERROR,
|
44
|
+
detail="Dependencies not initialized",
|
45
|
+
source_function="dependencies.register_service"
|
46
|
+
)
|
47
|
+
|
31
48
|
service_name = service_class.__name__
|
32
49
|
_service_registry[service_name] = {
|
33
50
|
"service_class": service_class,
|
@@ -103,9 +120,16 @@ def get_service(service_name: str) -> Callable:
|
|
103
120
|
Returns:
|
104
121
|
Callable: 서비스 의존성 함수
|
105
122
|
"""
|
123
|
+
if _session_provider is None:
|
124
|
+
raise CustomException(
|
125
|
+
ErrorCode.INTERNAL_ERROR,
|
126
|
+
detail="Dependencies not initialized",
|
127
|
+
source_function="dependencies.get_service"
|
128
|
+
)
|
129
|
+
|
106
130
|
async def _get_service_dependency(
|
107
131
|
request: Request,
|
108
|
-
session: AsyncSession
|
132
|
+
session: AsyncSession = Depends(_session_provider)
|
109
133
|
) -> BaseService:
|
110
134
|
return await _get_service(service_name, session, request)
|
111
135
|
return _get_service_dependency
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.57"
|
@@ -5,12 +5,12 @@ aiteamutils/base_service.py,sha256=s2AcA-6_ogOQKgt2xf_3AG2s6tqBceU4nJoXO1II7S8,2
|
|
5
5
|
aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
|
6
6
|
aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
|
7
7
|
aiteamutils/database.py,sha256=x0x5gnSyGfwo_klL9O65RnGOQID6c9tH2miwFveVyoE,6326
|
8
|
-
aiteamutils/dependencies.py,sha256=
|
8
|
+
aiteamutils/dependencies.py,sha256=vkSEiXYsgeTEh8mEVtI_sMBjCmcUhxLyqFflAR5MpPU,6792
|
9
9
|
aiteamutils/enums.py,sha256=ipZi6k_QD5-3QV7Yzv7bnL0MjDz-vqfO9I5L77biMKs,632
|
10
10
|
aiteamutils/exceptions.py,sha256=_lKWXq_ujNj41xN6LDE149PwsecAP7lgYWbOBbLOntg,15368
|
11
11
|
aiteamutils/security.py,sha256=xFVrjttxwXB1TTjqgRQQgQJQohQBT28vuW8FVLjvi-M,10103
|
12
12
|
aiteamutils/validators.py,sha256=3N245cZFjgwtW_KzjESkizx5BBUDaJLbbxfNO4WOFZ0,7764
|
13
|
-
aiteamutils/version.py,sha256=
|
14
|
-
aiteamutils-0.2.
|
15
|
-
aiteamutils-0.2.
|
16
|
-
aiteamutils-0.2.
|
13
|
+
aiteamutils/version.py,sha256=iEd2OwHHOAuMG_ICyOZTObkqFKxGQjbDcLvqr9IZKXk,42
|
14
|
+
aiteamutils-0.2.57.dist-info/METADATA,sha256=y8dfe__6SqRo2LLuki2isEhePbvNg_sGNJiIzMm3U2s,1718
|
15
|
+
aiteamutils-0.2.57.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
aiteamutils-0.2.57.dist-info/RECORD,,
|
File without changes
|