feat(ssulbox): SNS 제목·설명·태그를 ssul_content에 저장
영상과 같이 업로드·SEO 결과를 행에 남기고, 다음 요청부터는 DB 값을 쓴다. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fde48e8674
commit
e47a97476d
9 files changed
+108
-36
No files matched your search
@@ -74,6 +74,9 @@ class UnifiedItem:
|
||||
comment_count: int = 0
|
||||
is_liked_by_me: bool = False
|
||||
poster_url: Optional[str] = None
|
||||
title: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
hashtags: Optional[list] = None
|
||||
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
@@ -192,6 +195,9 @@ def _video_branch(where: list, sort_by: str) -> Select:
|
||||
Video.created_at.label("created_at"),
|
||||
Video.task_id.label("task_id"),
|
||||
Video.poster_url.label("poster_url"),
|
||||
Video.title.label("title"),
|
||||
Video.description.label("description"),
|
||||
Video.hashtags.label("hashtags"),
|
||||
]
|
||||
if sort_by == SORT_LIKE:
|
||||
cols.append(_video_like_subq().label("sort_value"))
|
||||
@@ -211,6 +217,9 @@ def _ssul_branch(where: list, sort_by: str) -> Select:
|
||||
# UNION 은 컬럼 수·순서가 양쪽 같아야 한다. 썰박스에는 task_id 가 없다.
|
||||
literal("").label("task_id"),
|
||||
SsulContent.poster_url.label("poster_url"),
|
||||
SsulContent.title.label("title"),
|
||||
SsulContent.description.label("description"),
|
||||
SsulContent.hashtags.label("hashtags"),
|
||||
]
|
||||
if sort_by == SORT_LIKE:
|
||||
cols.append(_ssul_like_subq().label("sort_value"))
|
||||
@@ -403,6 +412,9 @@ def _to_items(rows) -> list[UnifiedItem]:
|
||||
created_at=r.created_at,
|
||||
task_id=r.task_id or "",
|
||||
poster_url=r.poster_url,
|
||||
title=r.title,
|
||||
description=r.description,
|
||||
hashtags=list(r.hashtags) if r.hashtags else None,
|
||||
)
|
||||
for r in rows
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user