ui(cupang): 박스룰 폼 3행 배치 + 목록 컬럼 정리/하드삭제

- 폼: 1행 제품명180/제품코드100, 2행 박스이름/박스당입수량, 3행 메모(전체폭)
- 목록 순서 제품명·제품코드·박스명·입수량·메모, 상태열/비활성 제거
- 삭제 버튼=완전삭제(delete_box_rule, 참조 라인 box_rule_id NULL 처리)
- 캐시 버전 f

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 06:11:57 +09:00
parent 2e3ea610b7
commit 90e286dc4d
10 changed files with 66 additions and 44 deletions
+15
View File
@@ -197,6 +197,21 @@ class CupangDBStore:
if cur.rowcount == 0:
raise KeyError(rule_id)
def delete_box_rule(self, *, rule_id: int) -> None:
"""완전 삭제(hard). 라인의 box_rule_id 는 ON DELETE 미설정이므로
참조 중이면 FK 위반 가능 → 참조 라인의 box_rule_id 를 먼저 NULL 처리."""
with self._pool.connection() as conn:
with conn.transaction():
conn.execute(
"UPDATE cupang_shipment_lines SET box_rule_id = NULL WHERE box_rule_id = %s",
(rule_id,),
)
cur = conn.execute(
"DELETE FROM cupang_box_rules WHERE id = %s", (rule_id,)
)
if cur.rowcount == 0:
raise KeyError(rule_id)
def box_rule_map(self) -> dict[str, dict[str, Any]]:
"""product_code → rule. 폼/계산에서 빠르게 조회하기 위한 dict."""
return {r["product_code"]: r for r in self.list_box_rules()}