aiteamutils 0.2.24__tar.gz → 0.2.26__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/PKG-INFO +1 -1
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/dependencies.py +16 -11
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/security.py +2 -1
- aiteamutils-0.2.26/aiteamutils/version.py +2 -0
- aiteamutils-0.2.24/aiteamutils/version.py +0 -2
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/.gitignore +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/README.md +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/__init__.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/base_model.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/base_repository.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/base_service.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/cache.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/config.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/database.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/enums.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/exceptions.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/aiteamutils/validators.py +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/pyproject.toml +0 -0
- {aiteamutils-0.2.24 → aiteamutils-0.2.26}/setup.py +0 -0
@@ -52,19 +52,24 @@ class ServiceRegistry:
|
|
52
52
|
service_registry = ServiceRegistry()
|
53
53
|
|
54
54
|
def get_service(name: str):
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
name (str): 서비스 이름
|
59
|
-
|
60
|
-
Returns:
|
61
|
-
Callable: 서비스 인스턴스를 반환하는 의존성 함수
|
62
|
-
"""
|
63
|
-
def _get_service(db: AsyncSession = Depends(get_db)):
|
64
|
-
db_service = DatabaseService(session=db)
|
55
|
+
def _get_service():
|
56
|
+
# 글로벌 DatabaseService 사용
|
57
|
+
db_service = get_database_service()
|
65
58
|
repository_class, service_class = service_registry.get(name)
|
59
|
+
|
60
|
+
# 이미 생성된 서비스가 있다면 재사용
|
61
|
+
if hasattr(service_registry, '_instances') and name in service_registry._instances:
|
62
|
+
return service_registry._instances[name]
|
63
|
+
|
66
64
|
repository = repository_class(db_service)
|
67
|
-
|
65
|
+
instance = service_class(repository, db_service)
|
66
|
+
|
67
|
+
# 생성된 인스턴스 캐싱
|
68
|
+
if not hasattr(service_registry, '_instances'):
|
69
|
+
service_registry._instances = {}
|
70
|
+
service_registry._instances[name] = instance
|
71
|
+
|
72
|
+
return instance
|
68
73
|
return _get_service
|
69
74
|
|
70
75
|
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/users/token")
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"""보안 관련 유틸리티."""
|
2
2
|
from datetime import datetime, timedelta, UTC
|
3
|
-
from typing import Dict, Any, Optional, Literal, Callable, Type
|
3
|
+
from typing import Dict, Any, Optional, Literal, Callable, Type
|
4
|
+
from sqlalchemy.orm import DeclarativeBase as Base
|
4
5
|
from fastapi import Request, HTTPException, status
|
5
6
|
from functools import wraps
|
6
7
|
from jose import jwt, JWTError
|
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
|