chore: main 병합 — 로그인 없이 댓글·좋아요, 구글 로그인만, 동네 이야기·카드뉴스 등 (차단 표 user_block 하나로 합침, 익명 댓글도 신고 가능)

This commit is contained in:
minaChoi committed 2026-10-26 10:00:40 +09:00
commit dba34675c8
408 files changed
+36377 -725

No files matched your search

+112 -2
View File
@@ -3,7 +3,7 @@ from datetime import date, datetime
from decimal import Decimal
from typing import Optional
from sqlalchemy import BigInteger, Boolean, Date, DateTime, Integer, Numeric, SmallInteger, String, func
from sqlalchemy import BigInteger, Boolean, Date, DateTime, ForeignKey, Integer, LargeBinary, Numeric, SmallInteger, String, Text, func
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
@@ -309,6 +309,44 @@ class Post(Base):
deleted: Mapped[bool] = mapped_column(Boolean, default=False)
class CardSet(Base):
__tablename__ = "card_set"
card_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
template: Mapped[str] = mapped_column(String(20))
topic: Mapped[Optional[str]] = mapped_column(String(60), nullable=True)
title: Mapped[str] = mapped_column(String(80))
caption: Mapped[str] = mapped_column(Text, default="")
copy: Mapped[dict] = mapped_column(JSONB, default=dict)
status: Mapped[int] = mapped_column(SmallInteger, default=1)
post_id: Mapped[Optional[int]] = mapped_column(BigInteger, nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
published_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
ig_media_id: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
hashtags: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
class CardImage(Base):
__tablename__ = "card_image"
card_id: Mapped[int] = mapped_column(BigInteger, ForeignKey("card_set.card_id", ondelete="CASCADE"), primary_key=True)
seq: Mapped[int] = mapped_column(SmallInteger, primary_key=True)
data: Mapped[bytes] = mapped_column(LargeBinary)
class Reel(Base):
__tablename__ = "reel"
reel_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
title: Mapped[str] = mapped_column(String(80))
caption: Mapped[str] = mapped_column(Text, default="")
hashtags: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
video: Mapped[bytes] = mapped_column(LargeBinary)
cover: Mapped[Optional[bytes]] = mapped_column(LargeBinary, nullable=True)
ig_media_id: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class User(Base):
__tablename__ = "users"
@@ -337,6 +375,14 @@ class PostLike(Base):
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class PostLikeAnon(Base):
__tablename__ = "post_like_anon"
post_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
ip_hash: Mapped[str] = mapped_column(String(64), primary_key=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class PostSave(Base):
__tablename__ = "post_save"
@@ -350,7 +396,9 @@ class Comment(Base):
comment_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
post_id: Mapped[int] = mapped_column(BigInteger)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True))
user_id: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), nullable=True)
ip_hash: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
region_name: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
body: Mapped[str] = mapped_column(String(60))
like_count: Mapped[int] = mapped_column(Integer, default=0)
report_count: Mapped[int] = mapped_column(Integer, default=0)
@@ -382,3 +430,65 @@ class CommentLike(Base):
comment_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class CommentLikeAnon(Base):
__tablename__ = "comment_like_anon"
comment_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
ip_hash: Mapped[str] = mapped_column(String(64), primary_key=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class MyGak(Base):
__tablename__ = "my_gak"
my_gak_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True))
name: Mapped[str] = mapped_column(String(12))
rule: Mapped[dict] = mapped_column(JSONB)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class Talk(Base):
__tablename__ = "talk"
talk_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True))
region_code: Mapped[str] = mapped_column(String(10))
body: Mapped[str] = mapped_column(String(100))
weather: Mapped[Optional[str]] = mapped_column(String(30), nullable=True)
image: Mapped[Optional[str]] = mapped_column(String(200), nullable=True)
topic: Mapped[int] = mapped_column(SmallInteger, default=1)
like_count: Mapped[int] = mapped_column(Integer, default=0)
report_count: Mapped[int] = mapped_column(Integer, default=0)
hidden: Mapped[bool] = mapped_column(Boolean, default=False)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
deleted: Mapped[bool] = mapped_column(Boolean, default=False)
class TalkLike(Base):
__tablename__ = "talk_like"
talk_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class TalkLikeAnon(Base):
__tablename__ = "talk_like_anon"
talk_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
ip_hash: Mapped[str] = mapped_column(String(64), primary_key=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class TalkReport(Base):
__tablename__ = "talk_report"
talk_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True)
reason: Mapped[int] = mapped_column(SmallInteger)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())