aiteamutils 0.2.133__py3-none-any.whl → 0.2.135__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/base_model.py +40 -1
- aiteamutils/database.py +0 -11
- aiteamutils/version.py +1 -1
- {aiteamutils-0.2.133.dist-info → aiteamutils-0.2.135.dist-info}/METADATA +1 -1
- {aiteamutils-0.2.133.dist-info → aiteamutils-0.2.135.dist-info}/RECORD +6 -6
- {aiteamutils-0.2.133.dist-info → aiteamutils-0.2.135.dist-info}/WHEEL +0 -0
aiteamutils/base_model.py
CHANGED
@@ -93,4 +93,43 @@ class BaseSchema(BaseModel):
|
|
93
93
|
|
94
94
|
def to_dict(self) -> Dict[str, Any]:
|
95
95
|
"""모델을 딕셔너리로 변환"""
|
96
|
-
return self.model_dump()
|
96
|
+
return self.model_dump()
|
97
|
+
|
98
|
+
class BaseFileModel(BaseColumn):
|
99
|
+
"""파일 관련 기본 모델"""
|
100
|
+
__abstract__ = True
|
101
|
+
|
102
|
+
entity_name: Mapped[str] = mapped_column(
|
103
|
+
String,
|
104
|
+
nullable=False,
|
105
|
+
doc="엔티티 이름"
|
106
|
+
)
|
107
|
+
entity_ulid: Mapped[str] = mapped_column(
|
108
|
+
String,
|
109
|
+
nullable=False,
|
110
|
+
doc="엔티티 ULID"
|
111
|
+
)
|
112
|
+
original_name: Mapped[str] = mapped_column(
|
113
|
+
String,
|
114
|
+
nullable=False,
|
115
|
+
doc="원본 파일명"
|
116
|
+
)
|
117
|
+
storage_path: Mapped[str] = mapped_column(
|
118
|
+
String,
|
119
|
+
nullable=False,
|
120
|
+
doc="저장 경로"
|
121
|
+
)
|
122
|
+
mime_type: Mapped[str] = mapped_column(
|
123
|
+
String,
|
124
|
+
nullable=False,
|
125
|
+
doc="MIME 타입"
|
126
|
+
)
|
127
|
+
size: Mapped[int] = mapped_column(
|
128
|
+
nullable=False,
|
129
|
+
doc="파일 크기(bytes)"
|
130
|
+
)
|
131
|
+
checksum: Mapped[str] = mapped_column(
|
132
|
+
String,
|
133
|
+
nullable=False,
|
134
|
+
doc="파일 체크섬"
|
135
|
+
)
|
aiteamutils/database.py
CHANGED
@@ -157,27 +157,21 @@ def process_response(
|
|
157
157
|
|
158
158
|
# Relationship 처리 (이미 로드된 관계만 처리)
|
159
159
|
for relationship in entity.__mapper__.relationships:
|
160
|
-
print(f"\n[DEBUG] Processing relationship: {relationship.key}")
|
161
160
|
if not relationship.key in entity.__dict__:
|
162
|
-
print(f"[DEBUG] Relationship {relationship.key} not in entity.__dict__")
|
163
161
|
continue
|
164
162
|
|
165
163
|
try:
|
166
164
|
value = getattr(entity, relationship.key)
|
167
|
-
print(f"[DEBUG] Relationship value: {value}")
|
168
165
|
|
169
166
|
# response_model이 있는 경우 해당 필드의 annotation type을 가져옴
|
170
167
|
nested_response_model = None
|
171
168
|
if response_model and relationship.key in response_model.model_fields:
|
172
169
|
field_info = response_model.model_fields[relationship.key]
|
173
170
|
nested_response_model = field_info.annotation
|
174
|
-
print(f"[DEBUG] Found nested response model for {relationship.key}: {nested_response_model}")
|
175
171
|
|
176
172
|
# Optional[ProjectResponse] 같은 경우 실제 모델 추출
|
177
173
|
if hasattr(nested_response_model, '__origin__') and nested_response_model.__origin__ is Union:
|
178
|
-
print(f"[DEBUG] Extracting actual model from Union type: {nested_response_model.__args__}")
|
179
174
|
nested_response_model = next((t for t in nested_response_model.__args__ if hasattr(t, 'model_fields')), None)
|
180
|
-
print(f"[DEBUG] Extracted model: {nested_response_model}")
|
181
175
|
|
182
176
|
if value is not None:
|
183
177
|
if isinstance(value, list):
|
@@ -186,15 +180,11 @@ def process_response(
|
|
186
180
|
for item in value
|
187
181
|
]
|
188
182
|
else:
|
189
|
-
print(f"[DEBUG] Processing single value with model: {nested_response_model}")
|
190
183
|
result[relationship.key] = process_response(value, nested_response_model)
|
191
|
-
print(f"[DEBUG] After processing relationship {relationship.key}: {result[relationship.key]}")
|
192
184
|
else:
|
193
185
|
result[relationship.key] = None
|
194
186
|
except Exception as e:
|
195
|
-
print(f"[DEBUG] Error processing relationship {relationship.key}: {str(e)}")
|
196
187
|
import traceback
|
197
|
-
print(f"[DEBUG] Full traceback: {traceback.format_exc()}")
|
198
188
|
result[relationship.key] = None
|
199
189
|
|
200
190
|
# response_model이 있는 경우 필터링
|
@@ -204,7 +194,6 @@ def process_response(
|
|
204
194
|
# response_model에 없는 키 제거
|
205
195
|
for key in current_keys:
|
206
196
|
if key not in response_model.model_fields:
|
207
|
-
print(f"[DEBUG] Removing key not in response model: {key}")
|
208
197
|
result.pop(key)
|
209
198
|
# 모델 검증 및 업데이트
|
210
199
|
try:
|
aiteamutils/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
"""버전 정보"""
|
2
|
-
__version__ = "0.2.
|
2
|
+
__version__ = "0.2.135"
|
@@ -1,15 +1,15 @@
|
|
1
1
|
aiteamutils/__init__.py,sha256=kRBpRjark0M8ZwFfmKiMFol6CbIILN3WE4f6_P6iIq0,1089
|
2
|
-
aiteamutils/base_model.py,sha256=
|
2
|
+
aiteamutils/base_model.py,sha256=0rs4cjnF2ea3Q2vBTj6F64BGk7ZglJsChsS7ne_R_tg,4056
|
3
3
|
aiteamutils/base_repository.py,sha256=vzBw3g3jCJetTDblZvZenEGXk89Qu_65_02C7QTcf8Q,4615
|
4
4
|
aiteamutils/base_service.py,sha256=nHikjwGp29QrQPr2W8Ye9sKxmVS_8prRG3Nu42TU1Ms,10670
|
5
5
|
aiteamutils/cache.py,sha256=07xBGlgAwOTAdY5mnMOQJ5EBxVwe8glVD7DkGEkxCtw,1373
|
6
6
|
aiteamutils/config.py,sha256=YdalpJb70-txhGJAS4aaKglEZAFVWgfzw5BXSWpkUz4,3232
|
7
|
-
aiteamutils/database.py,sha256=
|
7
|
+
aiteamutils/database.py,sha256=_aiS_akyJHHFSWZCmPcO82_O32xdUnXlNrPW5KhzxaA,20396
|
8
8
|
aiteamutils/enums.py,sha256=7WLqlcJqQWtETAga2WAxNp3dJTQIAd2TW-4WzkoHHa8,2498
|
9
9
|
aiteamutils/exceptions.py,sha256=pgf3ersezObyl17wAO3I2fb8m9t2OzWDX1mSjwAWm2Y,16035
|
10
10
|
aiteamutils/security.py,sha256=McUl3t5Z5SyUDVUHymHdDkYyF4YSeg4g9fFMML4W6Kw,11630
|
11
11
|
aiteamutils/validators.py,sha256=msOrha36xWsapm4VAh63YmFq1GVyC9tzZcjXYFCEZ_g,11949
|
12
|
-
aiteamutils/version.py,sha256=
|
13
|
-
aiteamutils-0.2.
|
14
|
-
aiteamutils-0.2.
|
15
|
-
aiteamutils-0.2.
|
12
|
+
aiteamutils/version.py,sha256=fdwI_s2lFV68CAZnF0FL52Cw9MKy1Mhcfci5r2bWY4o,43
|
13
|
+
aiteamutils-0.2.135.dist-info/METADATA,sha256=2erJHJYmx8Vw12QGwfyXEvQC3-z77qtFUxYve85aSvo,1719
|
14
|
+
aiteamutils-0.2.135.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
15
|
+
aiteamutils-0.2.135.dist-info/RECORD,,
|
File without changes
|