diff --git a/backend/app/routers/files.py b/backend/app/routers/files.py
index f89002a..2d59752 100644
--- a/backend/app/routers/files.py
+++ b/backend/app/routers/files.py
@@ -323,6 +323,24 @@ async def upload_file(
db: Session = Depends(get_db),
current_user: dict = Depends(get_current_user)
):
+ # π― νΈλμμ
μ€λ₯ λ°©μ§: μμ ν νΈλμμ
μ΄κΈ°ν
+ try:
+ # 1. νμ¬ νΈλμμ
μμ λ‘€λ°±
+ db.rollback()
+ print("π 1λ¨κ³: μ΄μ νΈλμμ
λ‘€λ°± μλ£")
+
+ # 2. μΈμ
μν μ΄κΈ°ν
+ db.close()
+ print("π 2λ¨κ³: μΈμ
λ«κΈ° μλ£")
+
+ # 3. μ μΈμ
μμ±
+ from ..database import get_db
+ db = next(get_db())
+ print("π 3λ¨κ³: μ μΈμ
μμ± μλ£")
+
+ except Exception as e:
+ print(f"β οΈ νΈλμμ
μ΄κΈ°ν μ€ μ€λ₯: {e}")
+ # μ€λ₯ λ°μ μμλ κ³μ μ§ν
# λ‘κ·Έ μ κ±°
if not validate_file_extension(file.filename):
raise HTTPException(
@@ -541,13 +559,24 @@ async def upload_file(
print(f"π 리λΉμ μ
λ‘λ: μ 체 {len(materials_to_classify)}κ° μμ¬ μ μ₯ (λ³κ²½μ¬ν μΆμ ν¬ν¨)")
# μ΄μ 리λΉμ μ μμ¬ μ‘°ν (λλ©΄λ²νΈ κΈ°μ€)
- prev_materials_query = text("""
- SELECT original_description, size_spec, material_grade, main_nom,
- drawing_name, line_no, quantity
- FROM materials
- WHERE file_id = :parent_file_id
- """)
- prev_materials_result = db.execute(prev_materials_query, {"parent_file_id": parent_file_id}).fetchall()
+ try:
+ # π― νΈλμμ
μ€λ₯ λ°©μ§: 쿼리 μ€ν μ λ‘€λ°±
+ db.rollback()
+ print("π 리λΉμ μμ¬ μ‘°ν μ νΈλμμ
λ‘€λ°±")
+
+ prev_materials_query = text("""
+ SELECT original_description, size_spec, material_grade, main_nom,
+ drawing_name, line_no, quantity
+ FROM materials
+ WHERE file_id = :parent_file_id
+ """)
+ prev_materials_result = db.execute(prev_materials_query, {"parent_file_id": parent_file_id}).fetchall()
+ print(f"β
μ΄μ 리λΉμ μμ¬ μ‘°ν μ±κ³΅: {len(prev_materials_result)}κ°")
+
+ except Exception as e:
+ print(f"β μ΄μ 리λΉμ μμ¬ μ‘°ν μ€ν¨: {e}")
+ # μ€λ₯ λ°μ μ λΉ κ²°κ³Όλ‘ μ²λ¦¬
+ prev_materials_result = []
# μ΄μ μμ¬λ₯Ό λμ
λλ¦¬λ‘ λ³ν (λλ©΄λ²νΈ + μ€λͺ
+ ν¬κΈ° + μ¬μ§λ‘ ν€ μμ±)
prev_materials_dict = {}
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 6745dbb..d6d98ba 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -649,11 +649,7 @@ function App() {
))
) : (
- <>
-
-
-
- >
+
)}
diff --git a/frontend/src/api.js b/frontend/src/api.js
index 9f6d396..9819f4f 100644
--- a/frontend/src/api.js
+++ b/frontend/src/api.js
@@ -3,8 +3,7 @@ import { logApiError } from './utils/errorLogger';
// νκ²½λ³μμμ API URLμ μ½μ (Vite κΈ°μ€)
// νλ‘λμ
μμλ nginx νλ‘μλ₯Ό ν΅ν΄ /api κ²½λ‘ μ¬μ©
-const API_BASE_URL = import.meta.env.VITE_API_URL ||
- (import.meta.env.DEV ? 'http://localhost:18000' : '/api');
+const API_BASE_URL = '/api';
console.log('API Base URL:', API_BASE_URL);
console.log('Environment:', import.meta.env.MODE);