feat(performance): 직접 추가 쇼핑몰(수동 입력)·쇼핑몰 그룹·설정 드래그 순서

- 마이그레이션 009: perf_marketplaces.is_custom·is_group·parent_code
- 설정: [+ 쇼핑몰 추가(수동 입력)]·[+ 그룹 추가], 이름 변경·삭제, 직접 추가 쇼핑몰 그룹 select
- custom_ 코드는 registry.get_adapter 가 수동 입력 전용 어댑터(CustomManualAdapter)로
- 매출 실적 표: 그룹 열 = 보이는 하위 쇼핑몰 합계(일 합계엔 안 더함), ▾/▸ 하위 열 접기(localStorage)
- 설정 표 ⠿ 드래그 → PUT /api/marketplace-order → sort_order, 화면 순서는 ordered_marketplaces 한 곳
- 테스트: test_custom_groups.py, perf_groups.browser.test.js

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 10:57:03 +09:00
parent 5ef9a55d91
commit e3a8649b41
18 changed files with 948 additions and 44 deletions
+36
View File
@@ -91,6 +91,7 @@ def main() -> None:
actx = build_ad_dashboard(FakeStore(), kind="month", anchor=date(2026, 10, 7), today=date(2026, 10, 7),
sales_codes=["cafe24", "coupang"])
actx["ad_sync_sources"] = [{"code": "google", "name": "구글 광고"}] # [구글 광고 불러오기]
actx["auto_sync"] = ctx["auto_sync"] # 광고비 탭도 다음 업데이트 카운트다운(router._auto_sync_ctx)
html = e.get_template("performance/ads.html").render(**base, active_tab="ads", **actx)
with open(os.path.join(OUT_DIR, "perf_ads.html"), "w", encoding="utf-8") as f:
f.write(html)
@@ -102,8 +103,43 @@ def main() -> None:
html = e.get_template("performance/settings.html").render(**base, active_tab="settings", **sctx)
with open(os.path.join(OUT_DIR, "perf_settings.html"), "w", encoding="utf-8") as f:
f.write(html)
# 직접 추가 쇼핑몰·그룹(2026-10-22) — perf_dash_groups.html · perf_settings_groups.html (perf_groups.browser.test.js)
gctx = build_dashboard(GroupStore(), kind="week", anchor=date(2026, 10, 7), today=date(2026, 10, 7))
gctx["auto_sync"] = None
html = e.get_template("performance/index.html").render(**base, active_tab="dashboard", metric="gross", **gctx)
with open(os.path.join(OUT_DIR, "perf_dash_groups.html"), "w", encoding="utf-8") as f:
f.write(html)
gsctx = build_settings(GroupStore(), configured={}, key_info={"ok": True}, key_versions_in_use={}, sample_count=0)
gsctx.update(ad_api_ready=True, ad_sources=[])
html = e.get_template("performance/settings.html").render(**base, active_tab="settings", **gsctx)
with open(os.path.join(OUT_DIR, "perf_settings_groups.html"), "w", encoding="utf-8") as f:
f.write(html)
print("ok")
class GroupStore(FakeStore):
"""카페24·네이버 + 그룹 '오프라인'(매장A·매장B) + 그룹 없는 직접 추가 '행사'."""
def list_marketplaces(self):
rows = [{"code": c, "name": NAMES[c], "enabled": True, "include_in_sales": True, "sort_order": i * 10,
"manual_input": False, "is_custom": False, "is_group": False, "parent_code": None}
for i, c in enumerate(("cafe24", "naver"), 1)]
custom = {"enabled": True, "include_in_sales": True, "manual_input": True, "is_custom": True, "is_group": False}
return rows + [
{"code": "group_off", "name": "오프라인", "sort_order": 30, "enabled": True, "include_in_sales": False,
"manual_input": False, "is_custom": True, "is_group": True, "parent_code": None},
{**custom, "code": "custom_a", "name": "매장A", "sort_order": 40, "parent_code": "group_off"},
{**custom, "code": "custom_b", "name": "매장B", "sort_order": 50, "parent_code": "group_off"},
{**custom, "code": "custom_c", "name": "행사", "sort_order": 60, "parent_code": None},
]
def manual_amounts(self, start, end, codes, *, active_only=True):
manual = {(date(2026, 10, 5), "custom_a"): 30000, (date(2026, 10, 5), "custom_b"): 12000}
return {k: v for k, v in manual.items() if start <= k[0] <= end and k[1] in codes}
def ad_amounts(self, start, end):
return {}, {}
if __name__ == "__main__":
main()