feat(performance): 날짜 칸 메모·광고비 표 열 너비 자동/날짜 열 고정·기타광고비 열
- 매출 실적·광고비 금액 입력 칸 우클릭 → 메모 삽입·수정·삭제(창), 메모 있는 칸 빨간 삼각형·마우스 올리면 메모 상자
(마이그레이션 010 perf_cell_memos, PUT /api/cell-memos/{kind}/{code}/{date})
- 광고비 표도 열 너비 = 내용 길이, 날짜 열 가로 스크롤 고정(perf-autofit)
- 기타광고비 열(etc, 애터미아자몰 오른쪽) — ROAS 없음
- 테스트: test_cell_memos.py, perf_memo_ads.browser.test.js, 기존 채널 목록 기대값
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -498,6 +498,38 @@ def _ad_channel(channel: str) -> str:
|
||||
return channel
|
||||
|
||||
|
||||
MEMO_MAX = 1000
|
||||
|
||||
|
||||
@router.put("/api/cell-memos/{kind}/{code}/{day}")
|
||||
def api_cell_memo(request: Request, kind: str, code: str, day: str, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
"""날짜 칸 메모(2026-10-22, 마이그레이션 010) — kind = sales(매출 실적, 쇼핑몰) / ad(광고비, 광고 채널).
|
||||
memo 가 비면 지움. 칸에 금액을 넣을 수 있는 사람(모듈 권한자 누구나)이 쓴다."""
|
||||
from .ad_spend import CHANNEL_NAMES # noqa: WPS433
|
||||
from .db import MemoMigrationNeeded # noqa: WPS433
|
||||
|
||||
store, user = common.require_store(request)
|
||||
if kind == "sales":
|
||||
_code_or_404(store, code)
|
||||
elif kind == "ad":
|
||||
if code not in CHANNEL_NAMES:
|
||||
raise HTTPException(status_code=404, detail="알 수 없는 광고 채널입니다.")
|
||||
else:
|
||||
raise HTTPException(status_code=404, detail="알 수 없는 메모 종류입니다.")
|
||||
d = _parse_date(day)
|
||||
if d is None:
|
||||
raise HTTPException(status_code=400, detail="날짜가 필요합니다.")
|
||||
memo = str(payload.get("memo") or "").replace("\r\n", "\n").strip()
|
||||
if len(memo) > MEMO_MAX:
|
||||
raise HTTPException(status_code=400, detail=f"메모는 {MEMO_MAX:,}자까지 쓸 수 있습니다.")
|
||||
try:
|
||||
store.set_cell_memo(kind, code, d, memo or None, user=user.get("email", ""))
|
||||
except MemoMigrationNeeded:
|
||||
raise HTTPException(status_code=503, detail="메모를 쓰려면 performance_db 마이그레이션 010"
|
||||
"(scripts/sql/performance_db_010_cell_memos.sql)을 먼저 적용해야 합니다.") from None
|
||||
return JSONResponse({"ok": True, "kind": kind, "code": code, "date": d.isoformat(), "memo": memo})
|
||||
|
||||
|
||||
@router.put("/api/ad-spend/{channel}/{day}")
|
||||
def api_ad_spend(request: Request, channel: str, day: str, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
from .ad_spend import AdMigrationNeeded # noqa: WPS433
|
||||
|
||||
Reference in New Issue
Block a user