get_db_pool()은 동기 함수인데 B07만 await로 불렀다. 그 결과 풀 대신 _PoolConnectionContextManager가 잡혀 acquire()에서 터졌다. AttributeError: '_PoolConnectionContextManager' object has no attribute 'acquire' 좌측 패널 [확정]을 누를 때마다 stage 4가 전이되지 않고 500이 났다(서버 로그 확인). 프로젝트 안에서 await를 붙인 호출부는 여기 한 곳뿐이다. ruff format·check 통과. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
"""B07 수량 산출 라우터 — 셸 단계.
|
|
|
|
수량 본문은 미구현. 지금은 좌측 패널 [확정] 버튼이 워크플로 stage 4(QUANTITY)를
|
|
완료 처리해 B08 상세설계 진입을 여는 역할만 한다. 본문(B06 종횡단 기반 산출)을
|
|
구현할 때 이 라우터를 확장한다.
|
|
"""
|
|
|
|
import logging
|
|
from uuid import UUID
|
|
|
|
from fastapi import APIRouter
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from common_util.common_util_workflow_state import complete_stage
|
|
from config.config_db import get_db_pool
|
|
|
|
logger = logging.getLogger(__name__)
|
|
router = APIRouter(prefix="/api/projects", tags=["B07 Quantity"])
|
|
|
|
|
|
@router.post("/{project_id}/quantity/confirm")
|
|
async def confirm_quantity(project_id: UUID) -> JSONResponse:
|
|
"""수량 단계 확정 — stage 4(QUANTITY)를 COMPLETE로 전이한다 (본문 미구현)."""
|
|
pool = get_db_pool()
|
|
async with pool.acquire() as connection:
|
|
try:
|
|
async with connection.cursor() as cursor:
|
|
await complete_stage(cursor, str(project_id), 4)
|
|
await connection.commit()
|
|
except Exception:
|
|
await connection.rollback()
|
|
logger.exception("B07 수량 확정 실패: project_id=%s", project_id)
|
|
return JSONResponse(
|
|
status_code=500,
|
|
content={"status": "error", "message": "수량 단계 확정에 실패했습니다."},
|
|
)
|
|
return JSONResponse(content={"status": "success", "project_id": str(project_id)})
|