refactor(cupang): UI에서 제거된 기능의 죽은 코드 정리

- 엑셀 내보내기 전체 제거: /export, /{id}/export, _build_xlsx,
  _flatten_for_sheet, shipments_for_export, SHEET_COLUMNS
- 미사용 라우트 제거: /api/calendar, /api/products/search, /api/box-calc,
  /{id}/status(상태변경 UI 삭제됨)
- 미사용 db 메서드 제거: deactivate_box_rule, get_box_rule, box_rule_map
- form.html window.CPG + cpg-search-pop, cupang.js CFG, 검색 드롭다운 CSS 제거
- 템플릿 미사용 statuses 컨텍스트 제거, router import 정리
- 캐시 버전 k

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 06:37:51 +09:00
parent bcbf3de24c
commit 57f0c3426f
13 changed files with 13 additions and 271 deletions
-39
View File
@@ -144,17 +144,6 @@ class CupangDBStore:
).fetchall()
return [self._rule_serialize(r) for r in rows]
def get_box_rule(self, *, product_code: str) -> dict[str, Any] | None:
code = (product_code or "").strip()
if not code:
return None
with self._pool.connection() as conn:
row = conn.execute(
"SELECT * FROM cupang_box_rules WHERE product_code = %s AND active = TRUE",
(code,),
).fetchone()
return self._rule_serialize(row) if row else None
def upsert_box_rule(
self,
*,
@@ -188,15 +177,6 @@ class CupangDBStore:
).fetchone()
return self._rule_serialize(row)
def deactivate_box_rule(self, *, rule_id: int) -> None:
with self._pool.connection() as conn:
cur = conn.execute(
"UPDATE cupang_box_rules SET active = FALSE WHERE id = %s",
(rule_id,),
)
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 처리."""
@@ -212,10 +192,6 @@ class CupangDBStore:
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()}
# ════════════════════════════════════════════════════════════
# 제품명 카탈로그 (cupang_products)
# itemcode_db 에서 가져와 등록한 제품 목록. 폼의 제품명 드롭다운 소스.
@@ -498,21 +474,6 @@ class CupangDBStore:
_accumulate(arr, "arrival")
return out
def shipments_for_export(
self, *, year: int | None = None, month: int | None = None, shipment_id: int | None = None
) -> list[dict[str, Any]]:
"""엑셀 내보내기용 — 헤더+라인 평탄화 전 단계. 라인 포함 묶음 리스트 반환."""
if shipment_id is not None:
s = self.get_shipment(shipment_id=shipment_id)
return [s] if s else []
heads = self.list_shipments(year=year, month=month)
result = []
for h in heads:
full = self.get_shipment(shipment_id=h["id"])
if full:
result.append(full)
return result
# ════════════════════════════════════════════════════════════
# 정규화 / 직렬화 helpers
# ════════════════════════════════════════════════════════════