fix(cafe24): 앞 커밋에서 누락된 디자인파일 일반화 변경분 포함

config.py(Cafe24FtpConfig 일반화 + DESIGN_FILE_SPECS)·db.py(add/list_design_
revision)·router.py(design_files_router 연결)·_nav.html(탭 3개)·테스트·
.env.example·문서가 앞 커밋(8c2a9c4)에 함께 올라갔어야 하는데 스테이징 누락.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 14:50:58 +09:00
parent 8c2a9c47e1
commit e14d303b82
8 changed files with 140 additions and 64 deletions
+12 -10
View File
@@ -320,14 +320,16 @@ class Cafe24Store:
return self._serialize(row)
# ════════════════════════════════════════════════════════════
# 모바일 스와이프(product-swiper.js) 버전 (append-only)
# 상품이 아니라 디자인 보관함 FTP 파일이라 별도 테이블을 쓴다
# (cafe24_product_revisions.product_no 는 NOT NULL).
# 디자인 보관함 FTP 파일 버전 (append-only) — 모바일 스와이프
# (product-swiper.js), PC/모바일 상품상세 템플릿(detail.html) 등.
# 상품이 아니라 FTP 파일이라 별도 테이블을 쓴다
# (cafe24_product_revisions.product_no 는 NOT NULL). file_key 로 파일을
# 구분한다 — "swiper" / "mobile_detail" / "pc_detail" (config.py 의
# DESIGN_FILE_SPECS 키와 일치해야 한다).
# ════════════════════════════════════════════════════════════
SWIPER_FILE_KEY = "product-swiper"
def add_swiper_revision(
self, *, content: str, revision_type: str, memo: str = "", created_by: str = ""
def add_design_revision(
self, *, file_key: str, content: str, revision_type: str,
memo: str = "", created_by: str = "",
) -> int:
with self._pool.connection() as conn:
row = conn.execute(
@@ -338,7 +340,7 @@ class Cafe24Store:
RETURNING id
""",
(
self.SWIPER_FILE_KEY,
file_key,
content or "",
store.normalize_revision_type(revision_type),
(memo or "")[:500],
@@ -347,7 +349,7 @@ class Cafe24Store:
).fetchone()
return int(row["id"]) if row else 0
def list_swiper_revisions(self, *, limit: int = 20) -> list[dict[str, Any]]:
def list_design_revisions(self, file_key: str, *, limit: int = 20) -> list[dict[str, Any]]:
"""버전 목록. content 는 커질 수 있어 길이만 계산해서 준다."""
with self._pool.connection() as conn:
rows = conn.execute(
@@ -359,7 +361,7 @@ class Cafe24Store:
ORDER BY created_at DESC, id DESC
LIMIT %s
""",
(self.SWIPER_FILE_KEY, max(1, min(int(limit), 200))),
(file_key, max(1, min(int(limit), 200))),
).fetchall()
return [self._serialize(r) for r in rows]