Merge branch 'main' into 홈페이지-레이아웃-구상
# Conflicts: # docs/DEVLOG.md # solution/backend/crud/site_crud.py # solution/backend/router/router.py # solution/backend/router/v1/site/protocol.py
This commit is contained in:
commit
41e49c693b
77 files changed
+4828
-658
No files matched your search
@@ -88,6 +88,7 @@ app.include_router(router.v1.faq.faq.router)
|
||||
app.include_router(router.v1.media.media.router)
|
||||
app.include_router(router.v1.job.job.router)
|
||||
app.include_router(router.v1.site.site.router)
|
||||
app.include_router(router.v1.site.site.my_router)
|
||||
# ★ 인증 없는 공개 목록. 랜딩이 부른다 — 어드민 진입점(:9801)에는 붙이지 않는다.
|
||||
app.include_router(router.v1.site.showcase.router)
|
||||
app.include_router(router.v1.local.local.router)
|
||||
|
||||
@@ -8,12 +8,13 @@ from common.enums import (
|
||||
BuildStatus,
|
||||
JobStatus,
|
||||
PlaceCategory,
|
||||
PlaceStatus,
|
||||
PublishAction,
|
||||
PublishRejectReason,
|
||||
PublishResult,
|
||||
SiteStatus,
|
||||
)
|
||||
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
|
||||
from common.models.gmodel import Res_PageProtocol, Res_WebPacketProtocol, WebPacketProtocol
|
||||
|
||||
|
||||
class SiteProtocol(WebPacketProtocol):
|
||||
@@ -66,6 +67,32 @@ class SiteData(WebPacketProtocol):
|
||||
thumbnail_url: Optional[str] = None
|
||||
|
||||
|
||||
class MySiteData(WebPacketProtocol):
|
||||
"""내 사이트 목록의 한 줄 — 사업장(place) + 사이트(site).
|
||||
|
||||
★ render 는 여기 없다 — 보고서 **파일**을 읽는 값이라 줄 수만큼 파일 IO 가 된다(단건이 소유).
|
||||
★ site_id 아래가 전부 None 이면 아직 사이트가 없는 사업장이다."""
|
||||
|
||||
place_id: uuid.UUID
|
||||
name: str
|
||||
category: PlaceCategory
|
||||
place_status: PlaceStatus
|
||||
road_address: Optional[str] = None
|
||||
created_at: Optional[datetime] = None
|
||||
|
||||
site_id: Optional[uuid.UUID] = None
|
||||
status: Optional[SiteStatus] = None
|
||||
domain: Optional[str] = None
|
||||
template_id: Optional[str] = None
|
||||
published_at: Optional[datetime] = None
|
||||
# 단건과 같은 규칙 — 노출값이 마지막 빌드보다 나중에 바뀌었으면 재발행 대상이다.
|
||||
needs_rebuild: bool = False
|
||||
|
||||
|
||||
class Res_MySites(Res_PageProtocol):
|
||||
sites: list[MySiteData] = []
|
||||
|
||||
|
||||
class PublishLogData(WebPacketProtocol):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
@@ -97,9 +124,9 @@ class Req_SiteTheme(SiteProtocol):
|
||||
떨어뜨리므로 화면은 깨지지 않는다.
|
||||
|
||||
★ 그래서 필드를 펼치지 않고 dict 하나로 받는다. 계약은 이렇다:
|
||||
{"theme": {"colors": {...}, "fontStyle": "...", "colorPaletteId": "...", "sections": [...]}}
|
||||
sections 는 {id, name, enabled, locked, variantId?, body?} 의 목록이고 **배열 순서가 곧 섹션 순서**다
|
||||
(별도 order 필드가 없다). variantId 와 직접 입력 본문 body 는 값이 있을 때만 키가 붙는다.
|
||||
{"theme": {"colors": {...}, "fontStyle": "...", "look": {...}, "colorPaletteId": "...", "sections": [...]}}
|
||||
sections 는 {id, name, enabled, locked, variantId?, body?, data?} 의 목록이고 **배열 순서가 곧 섹션 순서**다
|
||||
(별도 order 필드가 없다). variantId·본문 body·붙여넣기 JSON data 는 값이 있을 때만 키가 붙는다.
|
||||
pydantic 으로 모양을 고정하면 프론트가 항목을 추가한 순간 백엔드가 그걸 조용히 떨어뜨린다 —
|
||||
서버는 배달부지 심판이 아니다.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
|
||||
from common.models.gmodel import UserInfo
|
||||
from common.models.gmodel import PageParams, UserInfo
|
||||
from router.v1.validator.dependencies import IsValidAccessToken, RemoveNoneResponse
|
||||
from services.site_service import SiteService
|
||||
from .protocol import (
|
||||
@@ -11,6 +11,7 @@ from .protocol import (
|
||||
Req_SiteTemplate,
|
||||
Req_SiteTheme,
|
||||
Req_StartBuild,
|
||||
Res_MySites,
|
||||
Res_PublishLogs,
|
||||
Res_Site,
|
||||
Res_SeoAudit,
|
||||
@@ -23,6 +24,25 @@ from .protocol import (
|
||||
# 사이트/발행 라우터. 사업장 하위 리소스이며 회사 스코프는 service 가 사업장 조회로 강제한다.
|
||||
router = APIRouter(prefix="/v1/place/{place_id}/site", tags=["Site"], responses={404: {"description": "Not found"}})
|
||||
|
||||
# ★ 내 사이트 목록은 사업장 하위가 아니라 계정 하위다 — 위 라우터는 접두어에 place_id 가 박혀 있어
|
||||
# "내 것 전부"가 들어갈 자리가 없다. 라우터 객체를 하나 더 둔다(router.py 에서 같이 등록).
|
||||
my_router = APIRouter(prefix="/v1/site", tags=["Site"], responses={404: {"description": "Not found"}})
|
||||
|
||||
|
||||
@my_router.get(
|
||||
path="/list",
|
||||
response_model=Res_MySites,
|
||||
summary="내 사이트 목록",
|
||||
description="로그인한 계정(회사)이 가진 사이트 전부. 아직 사이트가 만들어지지 않은 사업장도 "
|
||||
"site_id=null 로 함께 내려간다 — 위저드를 걸어오다 만 것을 목록에서 잃지 않게 한다.",
|
||||
)
|
||||
async def list_my_sites(
|
||||
service: SiteService = Depends(),
|
||||
user_info: UserInfo = Depends(IsValidAccessToken),
|
||||
pg: PageParams = Depends(),
|
||||
):
|
||||
return RemoveNoneResponse(await service.list_my_sites(user_info, pg))
|
||||
|
||||
|
||||
@router.get(
|
||||
path="",
|
||||
@@ -105,8 +125,8 @@ async def set_template(
|
||||
summary="디자인(색·서체·섹션) 저장",
|
||||
description="에디터가 정한 색·서체·섹션(순서·on/off·배리에이션)을 sites.theme 에 저장한다"
|
||||
"(사이트 행이 없으면 만든다). body 최상위 키는 theme 하나다: "
|
||||
"{\"theme\":{\"colors\":{...},\"fontStyle\":\"...\",\"colorPaletteId\":\"...\","
|
||||
"\"sections\":[{\"id\",\"name\",\"enabled\",\"locked\",\"variantId\",\"body\"}]}}. "
|
||||
"{\"theme\":{\"colors\":{...},\"fontStyle\":\"...\",\"look\":{...},\"colorPaletteId\":\"...\","
|
||||
"\"sections\":[{\"id\",\"name\",\"enabled\",\"locked\",\"variantId\",\"body\",\"data\"}]}}. "
|
||||
"★ sections 의 배열 순서가 곧 섹션 순서다(별도 order 필드 없음). "
|
||||
"★ 서버는 값을 해석하지 않는다 — 섹션 목록·배리에이션 키·색 토큰은 프론트가 소유한다. "
|
||||
"직렬화 크기(64KB)만 막는다. "
|
||||
|
||||
Reference in new issue
Block a user