aiteamutils 0.2.40__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 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
- return await self.create_entity(model, log_data)
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/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  """버전 정보"""
2
- __version__ = "0.2.40"
2
+ __version__ = "0.2.41"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiteamutils
3
- Version: 0.2.40
3
+ Version: 0.2.41
4
4
  Summary: AI Team Utilities
5
5
  Project-URL: Homepage, https://github.com/yourusername/aiteamutils
6
6
  Project-URL: Issues, https://github.com/yourusername/aiteamutils/issues
@@ -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=ATFiwG_o6o1eeUa0VVQ_2E_ExC2Yg-Ui_eA62SL6vQk,35344
7
+ aiteamutils/database.py,sha256=l_ZykepKquKRdsBZwLAeLHEYxhM4Ac4bknWtYNHurOo,35928
8
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=r4koaMfodnLfd4IMWK3LkRqImEOtPrTfnvj9iHsKNak,42
14
- aiteamutils-0.2.40.dist-info/METADATA,sha256=6EErFhk04VSuc_BO7JcenZSYnZYnp-gAJ82eVqFLiFg,1718
15
- aiteamutils-0.2.40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- aiteamutils-0.2.40.dist-info/RECORD,,
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,,