feat: P2V 파이프라인 연동 및 좋아요·댓글·공유 지원
- 무빙 포스터(p2v_video)·롱컷(p2v_playreel) 파이프라인과 워커, 갤러리·내 콘텐츠 노출 - 좋아요·댓글: comment/video_reaction에 p2v_playreel_id 추가, 종류별 CHECK 확장 - P2V 소프트 삭제(is_deleted), queued/running 삭제 차단 - 공개 상세·공유 OG 페이지 추가 - 삭제된 부모 댓글이 목록에서 사라지던 has_live_reply 서브쿼리 버그 수정 - 마이그레이션: migration_2026-10-15_p2v_reactions.sql
This commit is contained in:
1 parent
bb1ea12958
commit
b16d4a8f1b
126 files changed
+6921
-62
No files matched your search
+29
-6
@@ -217,28 +217,39 @@ class VideoReaction(Base):
|
||||
사용자가 영상에 반응(현재는 좋아요)을 남기면 생성, 다시 누르면 삭제(토글).
|
||||
향후 reaction_type 컬럼 추가로 다양한 반응 종류 확장 가능.
|
||||
|
||||
**ADO2 영상과 썰박스 콘텐츠를 모두 담는다.** 대상은 `video_id` 또는 `content_id`
|
||||
중 **정확히 하나**만 채워지며 DB `CHECK` 로 강제한다.
|
||||
**ADO2 영상·썰박스·P2V(무빙 포스터·롱컷)를 모두 담는다.** 대상은 `video_id`,
|
||||
`content_id`, `p2v_video_id`, `p2v_playreel_id` 중 **정확히 하나**만 채워지며
|
||||
DB `CHECK` 로 강제한다. (DB 에는 옛 `p2v_poster_id` 도 남아 CHECK 에 포함돼 있으나
|
||||
대응 테이블이 모델에 없어 여기서는 매핑하지 않는다.)
|
||||
|
||||
1인 1회 보장은 유니크 두 개로 나눠서 한다. MySQL 은 NULL 을 서로 다른 값으로
|
||||
취급하므로, 썰박스 행(video_id IS NULL)이 아무리 많아도
|
||||
1인 1회 보장은 종류별 유니크로 나눠서 한다. MySQL 은 NULL 을 서로 다른 값으로
|
||||
취급하므로, 다른 종류 행(video_id IS NULL)이 아무리 많아도
|
||||
`uq_video_reaction_user_video` 에 걸리지 않는다 — 각자 자기 유니크만 지킨다.
|
||||
"""
|
||||
|
||||
__tablename__ = "video_reaction"
|
||||
__table_args__ = (
|
||||
CheckConstraint(
|
||||
"(video_id IS NULL) <> (content_id IS NULL)",
|
||||
"(video_id IS NOT NULL) + (content_id IS NOT NULL) "
|
||||
"+ (p2v_video_id IS NOT NULL) + (p2v_playreel_id IS NOT NULL) = 1",
|
||||
name="ck_video_reaction_one_target",
|
||||
),
|
||||
UniqueConstraint("user_uuid", "video_id", name="uq_video_reaction_user_video"),
|
||||
UniqueConstraint(
|
||||
"user_uuid", "content_id", name="uq_video_reaction_user_content"
|
||||
),
|
||||
UniqueConstraint(
|
||||
"user_uuid", "p2v_video_id", name="uq_video_reaction_user_p2v_video"
|
||||
),
|
||||
UniqueConstraint(
|
||||
"user_uuid", "p2v_playreel_id", name="uq_video_reaction_user_p2v_playreel"
|
||||
),
|
||||
Index("idx_video_reaction_video_id", "video_id"),
|
||||
# 카운트 집계가 content_id 로 묶으므로 선행 컬럼 인덱스가 필요하다
|
||||
# (유니크는 user_uuid 가 앞이라 이 용도로 못 쓴다).
|
||||
Index("idx_video_reaction_content_id", "content_id"),
|
||||
Index("idx_video_reaction_p2v_video_id", "p2v_video_id"),
|
||||
Index("idx_video_reaction_p2v_playreel_id", "p2v_playreel_id"),
|
||||
Index("idx_video_reaction_user_uuid", "user_uuid"),
|
||||
{
|
||||
"mysql_engine": "InnoDB",
|
||||
@@ -250,7 +261,7 @@ class VideoReaction(Base):
|
||||
id: Mapped[int] = mapped_column(
|
||||
Integer, primary_key=True, autoincrement=True, comment="고유 식별자"
|
||||
)
|
||||
# 대상은 아래 둘 중 **정확히 하나**만 채워진다 (ck_video_reaction_one_target).
|
||||
# 대상은 아래 넷 중 **정확히 하나**만 채워진다 (ck_video_reaction_one_target).
|
||||
video_id: Mapped[Optional[int]] = mapped_column(
|
||||
Integer,
|
||||
ForeignKey("video.id", ondelete="CASCADE"),
|
||||
@@ -264,6 +275,18 @@ class VideoReaction(Base):
|
||||
nullable=True,
|
||||
comment="썰박스 콘텐츠 id (ADO2 반응이면 NULL)",
|
||||
)
|
||||
p2v_video_id: Mapped[Optional[int]] = mapped_column(
|
||||
BigInteger,
|
||||
ForeignKey("p2v_video.id", ondelete="CASCADE"),
|
||||
nullable=True,
|
||||
comment="무빙 포스터 id (다른 종류 반응이면 NULL)",
|
||||
)
|
||||
p2v_playreel_id: Mapped[Optional[int]] = mapped_column(
|
||||
BigInteger,
|
||||
ForeignKey("p2v_playreel.id", ondelete="CASCADE"),
|
||||
nullable=True,
|
||||
comment="롱컷 id (다른 종류 반응이면 NULL)",
|
||||
)
|
||||
user_uuid: Mapped[str] = mapped_column(
|
||||
String(36),
|
||||
ForeignKey("user.user_uuid", ondelete="CASCADE"),
|
||||
|
||||
Reference in new issue
Block a user