feat(b07): 평면도 종류마다 축척 고르기 — 1/600 · 1/1,000 · 1/1,200 기본 · 유역도 1/6,000 고정(119-1)
- 종류 파일 scale(없거나 목록 밖이면 1200) · 추가 · 업데이트 인자 · 목록 밖 거절 - 장 나눔 · 도곽 범위 · 배경 절취 · 축척 글 · 도곽 칸 · IP 표 · 필지 라벨 · 측점 눈금 실거리 환산이 축척 따라감(함수 인자) - 「종류」 폼에 공용 「축척」 고르기 · 유역도 양식은 잠금 표시 - 시험 test_119_b07_plan_scale 새로 · test_b07_plan_kinds 종류 dict 에 scale Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPJGtfXo6GMbcpiboQC4uK
This commit is contained in:
@@ -26,6 +26,11 @@ from B07_DesignDetail.B07_DesignDetail_Router_Support_Plan import (
|
||||
update_kind,
|
||||
write_marks,
|
||||
)
|
||||
from config.config_system import (
|
||||
DRAWING_SCALE_BASIN,
|
||||
DRAWING_SCALE_PLAN,
|
||||
DRAWING_SCALE_PLAN_CHOICES,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix="/api/projects", tags=["B07 Design Detail"])
|
||||
@@ -36,6 +41,8 @@ class PlanKindRequest(BaseModel):
|
||||
pieces: list[str] = Field(default_factory=list)
|
||||
# 양식 — plan(평면도 · 조각 고름) · watershed(유역도). 추가에서만 쓰고 업데이트는 그대로 둔다.
|
||||
layout: str = "plan"
|
||||
# 축척 분모(`scales` 중 하나) — 없으면 추가는 1/1,200 · 업데이트는 지금 값 · 유역도 1/6,000.
|
||||
scale: int | None = None
|
||||
|
||||
|
||||
class PlanMark(BaseModel):
|
||||
@@ -52,6 +59,9 @@ def _state(root: Any) -> dict[str, Any]:
|
||||
return {
|
||||
"status": "success",
|
||||
"pieces": [{"id": piece, "name": name} for piece, name, _locked in PIECES],
|
||||
"scales": list(DRAWING_SCALE_PLAN_CHOICES),
|
||||
"default_scale": DRAWING_SCALE_PLAN,
|
||||
"watershed_scale": DRAWING_SCALE_BASIN,
|
||||
"kinds": list_kinds(root),
|
||||
"marks": read_marks(root),
|
||||
}
|
||||
@@ -84,7 +94,9 @@ async def post_plan_kind(project_id: UUID, request: PlanKindRequest) -> Any:
|
||||
"""종류 추가 — 양식 · 조각을 골라 이름을 붙인다."""
|
||||
try:
|
||||
root = await _project_root(project_id)
|
||||
await asyncio.to_thread(add_kind, root, request.name, request.pieces, request.layout)
|
||||
await asyncio.to_thread(
|
||||
add_kind, root, request.name, request.pieces, request.layout, request.scale
|
||||
)
|
||||
return await asyncio.to_thread(_state, root)
|
||||
except ValueError as exc:
|
||||
return _error(400, exc)
|
||||
@@ -95,7 +107,9 @@ async def put_plan_kind(project_id: UUID, kind_id: str, request: PlanKindRequest
|
||||
"""종류 업데이트 — 이름 · 조각을 고친다(기본 넷도)."""
|
||||
try:
|
||||
root = await _project_root(project_id)
|
||||
await asyncio.to_thread(update_kind, root, kind_id, request.name, request.pieces)
|
||||
await asyncio.to_thread(
|
||||
update_kind, root, kind_id, request.name, request.pieces, request.scale
|
||||
)
|
||||
return await asyncio.to_thread(_state, root)
|
||||
except ValueError as exc:
|
||||
return _error(400, exc)
|
||||
|
||||
Reference in New Issue
Block a user