57f0c3426f
- 엑셀 내보내기 전체 제거: /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>
46 lines
1.4 KiB
Python
46 lines
1.4 KiB
Python
"""쿠팡 밀크런(cupang) 모듈.
|
|
|
|
라우터/저장소/템플릿을 한 디렉토리에서 관리한다.
|
|
- 라우터: `router.py` (FastAPI APIRouter, prefix=/cupang)
|
|
- 저장소: `db.py` (cupang_db / PostgreSQL 전용) + `store.py` (상수/계산)
|
|
- 상품검색: `itemcode.py` (itemcode_db 읽기 전용)
|
|
- 템플릿: `templates/cupang/`
|
|
|
|
데이터 저장은 cupang_db 전용이다. CUPANG_DB_URL 미설정 시 build_cupang_store 는
|
|
None 을 반환하고, 라우터가 "설정 필요" 안내 페이지를 보여준다(앱은 죽지 않음).
|
|
"""
|
|
|
|
from typing import Any
|
|
|
|
from .router import router
|
|
from .store import DEFAULT_CENTERS, SHIP_METHODS, STATUSES, compute_boxes
|
|
|
|
__all__ = [
|
|
"router",
|
|
"STATUSES",
|
|
"SHIP_METHODS",
|
|
"DEFAULT_CENTERS",
|
|
"compute_boxes",
|
|
"build_cupang_store",
|
|
"build_itemcode_reader",
|
|
]
|
|
|
|
|
|
def build_cupang_store(*, dsn: str | None) -> Any:
|
|
"""CUPANG_DB_URL 이 있으면 CupangDBStore, 없으면 None.
|
|
|
|
JSON 폴백을 두지 않는다(운영 데이터 분기 방지). None 이면 라우터가 안내 페이지 표시.
|
|
"""
|
|
if not dsn:
|
|
return None
|
|
from .db import CupangDBStore # 지연 import (개발 환경 deps 없을 수 있음)
|
|
|
|
return CupangDBStore(dsn)
|
|
|
|
|
|
def build_itemcode_reader() -> Any:
|
|
"""itemcode_db 읽기 전용 상품 검색 리더. 설정 없으면 비활성(enabled=False)."""
|
|
from .itemcode import ItemcodeReader # 지연 import
|
|
|
|
return ItemcodeReader()
|