aiteamutils 0.2.39__py3-none-any.whl → 0.2.41__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- aiteamutils/database.py +26 -9
- aiteamutils/dependencies.py +4 -24
- aiteamutils/version.py +1 -1
- {aiteamutils-0.2.39.dist-info → aiteamutils-0.2.41.dist-info}/METADATA +1 -1
- {aiteamutils-0.2.39.dist-info → aiteamutils-0.2.41.dist-info}/RECORD +6 -6
- {aiteamutils-0.2.39.dist-info → aiteamutils-0.2.41.dist-info}/WHEEL +0 -0
aiteamutils/database.py
CHANGED
@@ -685,16 +685,33 @@ class DatabaseService:
|
|
685
685
|
|
686
686
|
Returns:
|
687
687
|
생성된 로그 엔티티
|
688
|
-
"""
|
689
|
-
# 공통 필드 추가 (ULID를 문자열로 변환)
|
690
|
-
log_data["ulid"] = str(ULID())
|
691
|
-
|
692
|
-
# request가 있는 경우 user-agent와 ip 정보 추가
|
693
|
-
if request:
|
694
|
-
log_data["user_agent"] = request.headers.get("user-agent")
|
695
|
-
log_data["ip_address"] = request.headers.get("x-forwarded-for")
|
696
688
|
|
697
|
-
|
689
|
+
Raises:
|
690
|
+
CustomException: 로그 생성 실패 시
|
691
|
+
"""
|
692
|
+
try:
|
693
|
+
# 공통 필드 추가 (ULID를 문자열로 변환)
|
694
|
+
log_data["ulid"] = str(ULID())
|
695
|
+
|
696
|
+
# request가 있는 경우 user-agent와 ip 정보 추가
|
697
|
+
if request:
|
698
|
+
log_data["user_agent"] = request.headers.get("user-agent")
|
699
|
+
log_data["ip_address"] = request.headers.get("x-forwarded-for")
|
700
|
+
|
701
|
+
# 데이터 전처리
|
702
|
+
processed_data = self.preprocess_data(model, log_data)
|
703
|
+
entity = model(**processed_data)
|
704
|
+
|
705
|
+
# 로그 엔티티 저장
|
706
|
+
self.db.add(entity)
|
707
|
+
await self.db.flush()
|
708
|
+
|
709
|
+
return entity
|
710
|
+
|
711
|
+
except Exception as e:
|
712
|
+
logging.error(f"Failed to create log: {str(e)}")
|
713
|
+
# 로그 생성 실패는 원래 작업에 영향을 주지 않도록 함
|
714
|
+
return None
|
698
715
|
|
699
716
|
async def soft_delete(
|
700
717
|
self,
|
aiteamutils/dependencies.py
CHANGED
@@ -99,35 +99,15 @@ def get_service(name: str):
|
|
99
99
|
"""
|
100
100
|
def _get_service(db_service: DatabaseService = Depends(get_database_service)):
|
101
101
|
try:
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
except CustomException as e:
|
106
|
-
raise CustomException(
|
107
|
-
ErrorCode.SERVICE_NOT_REGISTERED,
|
108
|
-
detail=f"Service '{name}' is not registered",
|
109
|
-
source_function="dependencies.get_service",
|
110
|
-
original_error=e
|
111
|
-
)
|
112
|
-
|
113
|
-
# 서비스 인스턴스 생성
|
114
|
-
try:
|
115
|
-
repository = repository_class(db_service)
|
116
|
-
return service_class(repository)
|
117
|
-
except Exception as e:
|
118
|
-
raise CustomException(
|
119
|
-
ErrorCode.INTERNAL_ERROR,
|
120
|
-
detail=f"Failed to create service instance for '{name}': {str(e)}",
|
121
|
-
source_function="dependencies.get_service",
|
122
|
-
original_error=e
|
123
|
-
)
|
124
|
-
|
102
|
+
repository_class, service_class = service_registry.get(name)
|
103
|
+
repository = repository_class(db_service)
|
104
|
+
return service_class(repository, db_service)
|
125
105
|
except CustomException as e:
|
126
106
|
raise e
|
127
107
|
except Exception as e:
|
128
108
|
raise CustomException(
|
129
109
|
ErrorCode.INTERNAL_ERROR,
|
130
|
-
detail=f"
|
110
|
+
detail=f"Failed to create service '{name}': {str(e)}",
|
131
111
|
source_function="dependencies.get_service",
|
132
112
|
original_error=e
|
133
113
|
)
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.41"
|
@@ -4,13 +4,13 @@ aiteamutils/base_repository.py,sha256=qdwQ7Sj2fUqxpDg6cWM48n_QbwPK_VUlG9zTSem8iC
|
|
4
4
|
aiteamutils/base_service.py,sha256=E4dHGE0DvhmRyFplh46SwKJOSF_nUL7OAsCkf_ZJF_8,24733
|
5
5
|
aiteamutils/cache.py,sha256=tr0Yn8VPYA9QHiKCUzciVlQ2J1RAwNo2K9lGMH4rY3s,1334
|
6
6
|
aiteamutils/config.py,sha256=kFKMeIx1KcuEwwx4VjZdCgoTOHCkG3ySYVJ0G6cvMoA,2849
|
7
|
-
aiteamutils/database.py,sha256=
|
8
|
-
aiteamutils/dependencies.py,sha256=
|
7
|
+
aiteamutils/database.py,sha256=l_ZykepKquKRdsBZwLAeLHEYxhM4Ac4bknWtYNHurOo,35928
|
8
|
+
aiteamutils/dependencies.py,sha256=hsJ-kc8ic4U6vKFtUIWjhBE1_Bm-sya5UqSb2zMH5oM,5731
|
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=9gvEqDtE3RJaoCWqELPCjkg-IsSqZVrpMP6XPZaodWU,16024
|
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=DT95upAYup68_YP0gm-cFpVbBYlrV8Snq10ztLShyy4,42
|
14
|
+
aiteamutils-0.2.41.dist-info/METADATA,sha256=LiQlMTbzxNqm_cZSqVunU5siBxpF-G0jhI5UqP3RC7c,1718
|
15
|
+
aiteamutils-0.2.41.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
aiteamutils-0.2.41.dist-info/RECORD,,
|
File without changes
|