aiteamutils 0.2.158__py3-none-any.whl → 0.2.160__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.
@@ -37,7 +37,7 @@ class BaseService(Generic[ModelType]):
37
37
  self.additional_models = additional_models or {},
38
38
 
39
39
  #######################
40
- # 입력 수정, 삭제 #
40
+ # 파일 관련 메서드 #
41
41
  #######################
42
42
  async def _separate_file_data(
43
43
  self,
@@ -52,30 +52,30 @@ class BaseService(Generic[ModelType]):
52
52
  Tuple[Dict[str, Any], Dict[str, Any]]: (파일 제외된 엔티티 데이터, 분리된 파일 데이터)
53
53
  """
54
54
  try:
55
- logger.info("[파일 데이터 분리 시작]")
56
55
  entity_data_copy = entity_data.copy()
57
56
  separated_files = {}
58
57
 
59
58
  if 'extra_data' in entity_data_copy and isinstance(entity_data_copy['extra_data'], dict):
60
59
  extra_data = entity_data_copy['extra_data'].copy()
60
+ fields_to_remove = []
61
61
 
62
- # 파일 필드 체크
62
+ # 파일 필드 체크 및 분리 (딕셔너리 수정 없이)
63
63
  for field_name, files in extra_data.items():
64
- logger.info(f"[필드 검사] 필드명: {field_name}, 타입: {type(files)}")
65
64
  if files and isinstance(files, (list, tuple)):
66
65
  # 파일 객체를 포함하는 튜플/리스트인 경우만 처리
67
66
  if any(isinstance(item, (tuple, list)) and len(item) == 2 and hasattr(item[0], 'read') for item in files):
68
- logger.info(f"[파일 필드 발견] {field_name}")
69
67
  separated_files[field_name] = files
70
- del extra_data[field_name]
68
+ fields_to_remove.append(field_name)
69
+
70
+ # 파일 필드 제거 (별도 단계로 분리)
71
+ for field_name in fields_to_remove:
72
+ del extra_data[field_name]
71
73
 
72
74
  entity_data_copy['extra_data'] = extra_data
73
75
 
74
- logger.info("[파일 데이터 분리 완료]")
75
76
  return entity_data_copy, separated_files
76
77
 
77
78
  except Exception as e:
78
- logger.error(f"[파일 분리 중 에러 발생] {str(e)}")
79
79
  raise CustomException(
80
80
  ErrorCode.INTERNAL_ERROR,
81
81
  detail=str(e),
@@ -107,12 +107,10 @@ class BaseService(Generic[ModelType]):
107
107
  source_function=f"{self.__class__.__name__}._save_files"
108
108
  )
109
109
 
110
- logger.info("[파일 저장 시작]")
111
110
  file_infos = {}
112
111
  from .files import FileHandler
113
112
 
114
113
  for field_name, files in separated_files.items():
115
- logger.info(f"[필드 처리] {field_name}, 파일 수: {len(files)}")
116
114
  saved_files = await FileHandler.save_files(
117
115
  files=files,
118
116
  storage_dir=storage_dir,
@@ -139,15 +137,12 @@ class BaseService(Generic[ModelType]):
139
137
  ]
140
138
 
141
139
  await self.db_session.flush()
142
- logger.info("[파일 저장 완료]")
143
140
  return file_infos
144
141
 
145
142
  except CustomException as e:
146
- logger.error(f"[파일 저장 중 CustomException 발생] {e.error_code}: {e.detail}")
147
143
  await self._cleanup_saved_files(file_infos)
148
144
  raise e
149
145
  except Exception as e:
150
- logger.error(f"[파일 저장 중 에러 발생] {str(e)}")
151
146
  await self._cleanup_saved_files(file_infos)
152
147
  raise CustomException(
153
148
  ErrorCode.FILE_SYSTEM_ERROR,
@@ -162,7 +157,6 @@ class BaseService(Generic[ModelType]):
162
157
  from .files import FileHandler
163
158
  for file_list in file_infos.values():
164
159
  for file_info in file_list:
165
- logger.info(f"[에러 복구] 파일 삭제: {file_info['storage_path']}")
166
160
  await FileHandler.delete_files(file_info["storage_path"])
167
161
 
168
162
  async def _delete_files(
@@ -175,7 +169,6 @@ class BaseService(Generic[ModelType]):
175
169
  entity_result (Any): 삭제할 파일이 있는 엔티티
176
170
  """
177
171
  try:
178
- logger.info("[파일 삭제 시작]")
179
172
  from .files import FileHandler
180
173
 
181
174
  # files 테이블에서 기존 파일 정보 조회
@@ -192,11 +185,9 @@ class BaseService(Generic[ModelType]):
192
185
  }
193
186
  )
194
187
  existing_files = existing_files.fetchall()
195
- logger.info(f"[기존 파일 조회 결과] {existing_files}")
196
188
 
197
189
  # 기존 파일 삭제
198
190
  for file_info in existing_files:
199
- logger.info(f"[파일 삭제] {file_info[0]}")
200
191
  await FileHandler.delete_files(file_info[0])
201
192
 
202
193
  # files 테이블에서 레코드 삭제
@@ -211,10 +202,8 @@ class BaseService(Generic[ModelType]):
211
202
  "entity_ulid": entity_result.ulid
212
203
  }
213
204
  )
214
- logger.info("[파일 DB 레코드 삭제 완료]")
215
205
 
216
206
  except Exception as e:
217
- logger.error(f"[파일 삭제 중 에러 발생] {str(e)}")
218
207
  raise CustomException(
219
208
  ErrorCode.FILE_SYSTEM_ERROR,
220
209
  detail=str(e),
@@ -222,6 +211,9 @@ class BaseService(Generic[ModelType]):
222
211
  original_error=e
223
212
  )
224
213
 
214
+ #######################
215
+ # 입력 및 수정 메서드 #
216
+ #######################
225
217
  async def create(
226
218
  self,
227
219
  request: Request,
@@ -396,6 +388,9 @@ class BaseService(Generic[ModelType]):
396
388
  original_error=e
397
389
  )
398
390
 
391
+ #######################
392
+ # 삭제 메서드 #
393
+ #######################
399
394
  async def delete(
400
395
  self,
401
396
  request: Request,
aiteamutils/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  """버전 정보"""
2
- __version__ = "0.2.158"
2
+ __version__ = "0.2.160"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiteamutils
3
- Version: 0.2.158
3
+ Version: 0.2.160
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
@@ -1,7 +1,7 @@
1
1
  aiteamutils/__init__.py,sha256=kRBpRjark0M8ZwFfmKiMFol6CbIILN3WE4f6_P6iIq0,1089
2
2
  aiteamutils/base_model.py,sha256=yBZqzTDF9PA4wCAvmYfG12FdVwLtxOEUCcA3z2i6fXU,4176
3
3
  aiteamutils/base_repository.py,sha256=Oy2zE1i5qx60Xf1tnsaKLyFWapiPqt5JH8NejwNrPWg,4647
4
- aiteamutils/base_service.py,sha256=Te4pM8MaIQBPKVj2hXp-qGIg33LhZFGAuyTEa6cOedQ,21775
4
+ aiteamutils/base_service.py,sha256=5YSRpulLI-tO6zQ75LBTsyzYoMzayPITWhE5-8rie3s,21068
5
5
  aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
6
6
  aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
7
7
  aiteamutils/database.py,sha256=msvBKtxWeQVOo0v2Q9i2azuTNtnUItuNNar52gdRZTo,20418
@@ -11,7 +11,7 @@ aiteamutils/files.py,sha256=Qq2w3VAEOzvsDirYtxRTN48LnIzf4TPUH2LftmyYtQk,12831
11
11
  aiteamutils/models.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
12
12
  aiteamutils/security.py,sha256=McUl3t5Z5SyUDVUHymHdDkYyF4YSeg4g9fFMML4W6Kw,11630
13
13
  aiteamutils/validators.py,sha256=_WHN6jqJQzKM5uPTg-Da8U2qqevS84XeKMkCCF4C_lY,9591
14
- aiteamutils/version.py,sha256=v8SkzOaeH4MzML2BpBBvIp2vQgQYhhiXyS2BKDpsXUY,43
15
- aiteamutils-0.2.158.dist-info/METADATA,sha256=tgeuWv9wOx5PnBCXNTwEXAlR5TFWcHXzKyJV5cYmD4U,1743
16
- aiteamutils-0.2.158.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
- aiteamutils-0.2.158.dist-info/RECORD,,
14
+ aiteamutils/version.py,sha256=Dv_RPFPM_ljwt7FQn4GsgrSYOBxg7SL2-aDSf-jrp30,43
15
+ aiteamutils-0.2.160.dist-info/METADATA,sha256=-mvX5XwdZbNh-6odVtUghcR6k9YU_P2eOv8XruEj5Gg,1743
16
+ aiteamutils-0.2.160.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
17
+ aiteamutils-0.2.160.dist-info/RECORD,,