- B07_DesignDetail_Quantity_Proto.py → B08_Quantity/B08_Quantity_Proto.py (git mv) - B07 라우터 include 2줄 원복, B08_Quantity_Router.py에 include - B08_Quantity_UI_Page.ts: 준비 중 셸 → createWorkflowLayout + 보고서 iframe 본문 - 접근: 대시보드 워크플로 칩 또는 #/b08-quantity (수량산출 칩은 stage 가드 적용) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
43 lines
1.7 KiB
Python
43 lines
1.7 KiB
Python
"""B08 수량 산출 라우터 — 셸 단계.
|
|
|
|
수량 본문은 미구현. 지금은 좌측 패널 [확정] 버튼이 워크플로 stage 5(QUANTITY)를
|
|
완료 처리해 B09 설계도서 진입을 여는 역할만 한다. 본문(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=["B08 Quantity"])
|
|
|
|
# 수량 산출 프로토타입 (처분 가능) — B08_Quantity_Proto.py 삭제 시 아래 2줄도 함께 지운다.
|
|
from B08_Quantity.B08_Quantity_Proto import proto_router # noqa: E402
|
|
|
|
router.include_router(proto_router)
|
|
|
|
|
|
@router.post("/{project_id}/quantity/confirm")
|
|
async def confirm_quantity(project_id: UUID) -> JSONResponse:
|
|
"""수량 단계 확정 — stage 5(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), 5)
|
|
await connection.commit()
|
|
except Exception:
|
|
await connection.rollback()
|
|
logger.exception("B08 수량 확정 실패: project_id=%s", project_id)
|
|
return JSONResponse(
|
|
status_code=500,
|
|
content={"status": "error", "message": "수량 단계 확정에 실패했습니다."},
|
|
)
|
|
return JSONResponse(content={"status": "success", "project_id": str(project_id)})
|