diff --git a/backend/routers/__pycache__/issues.cpython-311.pyc b/backend/routers/__pycache__/issues.cpython-311.pyc index 0973e38..067221c 100644 Binary files a/backend/routers/__pycache__/issues.cpython-311.pyc and b/backend/routers/__pycache__/issues.cpython-311.pyc differ diff --git a/backend/routers/issues.py b/backend/routers/issues.py index 317d787..7b3b571 100644 --- a/backend/routers/issues.py +++ b/backend/routers/issues.py @@ -313,12 +313,20 @@ async def request_completion( raise HTTPException(status_code=400, detail="이미 완료 신청된 부적합입니다.") try: + print(f"DEBUG: 완료 신청 시작 - Issue ID: {issue_id}, User: {current_user.username}") + # 완료 사진 저장 completion_photo_path = None if request.completion_photo: + print(f"DEBUG: 완료 사진 저장 시작") completion_photo_path = save_base64_image(request.completion_photo, "completion") + print(f"DEBUG: 완료 사진 저장 완료 - Path: {completion_photo_path}") + + if not completion_photo_path: + raise Exception("완료 사진 저장에 실패했습니다.") # 완료 신청 정보 업데이트 + print(f"DEBUG: DB 업데이트 시작") issue.completion_requested_at = datetime.now() issue.completion_requested_by_id = current_user.id issue.completion_photo_path = completion_photo_path @@ -326,6 +334,7 @@ async def request_completion( db.commit() db.refresh(issue) + print(f"DEBUG: DB 업데이트 완료") return { "message": "완료 신청이 성공적으로 제출되었습니다.", @@ -335,9 +344,10 @@ async def request_completion( } except Exception as e: + print(f"ERROR: 완료 신청 처리 오류 - {str(e)}") db.rollback() # 업로드된 파일이 있다면 삭제 - if completion_photo_path: + if 'completion_photo_path' in locals() and completion_photo_path: try: delete_file(completion_photo_path) except: diff --git a/backend/services/__pycache__/file_service.cpython-311.pyc b/backend/services/__pycache__/file_service.cpython-311.pyc index e9ed27c..45d44ec 100644 Binary files a/backend/services/__pycache__/file_service.cpython-311.pyc and b/backend/services/__pycache__/file_service.cpython-311.pyc differ diff --git a/backend/services/file_service.py b/backend/services/file_service.py index 487adf9..46fed89 100644 --- a/backend/services/file_service.py +++ b/backend/services/file_service.py @@ -13,7 +13,7 @@ def ensure_upload_dir(): if not os.path.exists(UPLOAD_DIR): os.makedirs(UPLOAD_DIR) -def save_base64_image(base64_string: str) -> Optional[str]: +def save_base64_image(base64_string: str, prefix: str = "image") -> Optional[str]: """Base64 이미지를 파일로 저장하고 경로 반환""" try: ensure_upload_dir() @@ -40,8 +40,8 @@ def save_base64_image(base64_string: str) -> Optional[str]: elif image.mode != 'RGB': image = image.convert('RGB') - # 파일명 생성 (강제로 .jpg) - filename = f"{datetime.now().strftime('%Y%m%d%H%M%S')}_{uuid.uuid4().hex[:8]}.jpg" + # 파일명 생성 (prefix 포함) + filename = f"{prefix}_{datetime.now().strftime('%Y%m%d%H%M%S')}_{uuid.uuid4().hex[:8]}.jpg" filepath = os.path.join(UPLOAD_DIR, filename) # 이미지 저장 (최대 크기 제한) diff --git a/frontend/issues-dashboard.html b/frontend/issues-dashboard.html index d7feb4d..0483cbd 100644 --- a/frontend/issues-dashboard.html +++ b/frontend/issues-dashboard.html @@ -181,29 +181,29 @@ -
- 지연 위험 -
- -0
-- 활성 프로젝트 + 완료 대기
-0
+0
+ 지연 중 +
+ +0
+