feat: 오늘 피드 — 사람 글을 묶음 대신 포스트처럼 두 장마다 한 장씩(큰 카드·댓글), 행사는 띠 대신 축제 전부와 팝업·전시·공연 2개씩 포스트로
- 사람 글 큰 카드: 머리줄·4:5 본문(사진, 없으면 글을 크게)·좋아요·댓글·보내기 - 사람 글 댓글: 로그인한 사람만, comment 표에 talk_id, talk.comment_count (init.sql) - '오늘 내 글'·'동네 사람들'·주제별 묶음, '이번 주 가까운 행사' 띠 제거 - 행사 포스트 자리 최대 40개, 앞쪽 절반에 다 못 들어가면 끝까지 한 장씩 걸러 - GA: feed_item_view(talk·event 노출), talk_comment
This commit is contained in:
1 parent
f6cb6f2deb
commit
dba3d78f14
22 files changed
+653
-318
No files matched your search
@@ -401,7 +401,9 @@ class Comment(Base):
|
||||
__tablename__ = "comment"
|
||||
|
||||
comment_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
post_id: Mapped[int] = mapped_column(BigInteger)
|
||||
# 포스트 댓글은 post_id, 사람 글 댓글은 talk_id 하나만 채운다
|
||||
post_id: Mapped[Optional[int]] = mapped_column(BigInteger, nullable=True)
|
||||
talk_id: Mapped[Optional[int]] = mapped_column(BigInteger, nullable=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)
|
||||
@@ -504,6 +506,7 @@ class Talk(Base):
|
||||
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)
|
||||
comment_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())
|
||||
|
||||
@@ -6,12 +6,20 @@ from sqlalchemy import delete, func, or_, select, update
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.database.model.models import Comment, CommentLike, CommentLikeAnon, CommentReport, Post, PostLike, PostLikeAnon, PostSave, User, UserBlock
|
||||
from common.database.model.models import Comment, CommentLike, CommentLikeAnon, CommentReport, Post, PostLike, PostLikeAnon, PostSave, Talk, User, UserBlock
|
||||
from common.liker import Liker
|
||||
|
||||
HIDE_AT = 3 # 신고가 이만큼 쌓이면 모두에게서 숨긴다
|
||||
|
||||
|
||||
async def _count(s: AsyncSession, post_id: Optional[int], talk_id: Optional[int], delta: int) -> None:
|
||||
"""댓글이 달린 곳(사람 글 또는 포스트)의 댓글 수를 고친다."""
|
||||
if talk_id is not None:
|
||||
await s.execute(update(Talk).where(Talk.talk_id == talk_id).values(comment_count=Talk.comment_count + delta))
|
||||
elif post_id is not None:
|
||||
await s.execute(update(Post).where(Post.post_id == post_id).values(comment_count=Post.comment_count + delta))
|
||||
|
||||
|
||||
async def toggle_like_row(s: AsyncSession, who: Liker, member: type, anon: type, id_name: str, id_value: int, on: bool) -> bool:
|
||||
"""로그인했으면 member 표에 user_id 로, 아니면 anon 표에 ip_hash 로 넣거나 지운다. 실제로 바뀌었으면 True."""
|
||||
model, keys = (member, {id_name: id_value, "user_id": who.user_id}) if who.user_id is not None else (anon, {id_name: id_value, "ip_hash": who.ip_hash})
|
||||
@@ -54,10 +62,13 @@ class ReactionCRUD:
|
||||
stmt = stmt.where(Post.post_id < cursor)
|
||||
return list((await s.execute(stmt.order_by(Post.post_id.desc()).limit(limit))).all())
|
||||
|
||||
async def comments(self, s: AsyncSession, post_id: int, viewer: Optional[uuid.UUID], cursor: Optional[int], limit: int) -> list[tuple[Comment, Optional[str], Optional[str], Optional[str], Optional[str]]]:
|
||||
"""로그인 없이 쓴 댓글은 User 칸이 모두 None 이다. 숨긴 댓글은 빼고, 보는 사람이 신고한 댓글·차단한 사람의 댓글도 뺀다."""
|
||||
async def comments(
|
||||
self, s: AsyncSession, post_id: Optional[int], viewer: Optional[uuid.UUID], cursor: Optional[int], limit: int, talk_id: Optional[int] = None,
|
||||
) -> list[tuple[Comment, Optional[str], Optional[str], Optional[str], Optional[str]]]:
|
||||
"""포스트(post_id) 또는 사람 글(talk_id)의 댓글. 로그인 없이 쓴 댓글은 User 칸이 모두 None 이다. 숨긴 댓글은 빼고, 보는 사람이 신고한 댓글·차단한 사람의 댓글도 뺀다."""
|
||||
target = Comment.talk_id == talk_id if talk_id is not None else Comment.post_id == post_id
|
||||
stmt = select(Comment, User.nickname, User.character, User.color, User.mood).outerjoin(User, User.user_id == Comment.user_id).where(
|
||||
Comment.post_id == post_id, Comment.deleted.is_(False), Comment.is_hidden.is_(False)
|
||||
target, Comment.deleted.is_(False), Comment.is_hidden.is_(False)
|
||||
)
|
||||
if viewer is not None:
|
||||
stmt = stmt.where(
|
||||
@@ -76,10 +87,11 @@ class ReactionCRUD:
|
||||
stmt = select(CommentLikeAnon.comment_id).where(CommentLikeAnon.ip_hash == ip_hash, CommentLikeAnon.comment_id.in_(comment_ids))
|
||||
return set((await s.scalars(stmt)).all())
|
||||
|
||||
async def add_comment(self, s: AsyncSession, post_id: int, who: Liker, body: str, region_name: Optional[str]) -> Comment:
|
||||
c = Comment(post_id=post_id, user_id=who.user_id, body=body) if who.user_id is not None else Comment(post_id=post_id, ip_hash=who.ip_hash, region_name=region_name, body=body)
|
||||
async def add_comment(self, s: AsyncSession, post_id: Optional[int], who: Liker, body: str, region_name: Optional[str], talk_id: Optional[int] = None) -> Comment:
|
||||
c = (Comment(post_id=post_id, talk_id=talk_id, user_id=who.user_id, body=body) if who.user_id is not None
|
||||
else Comment(post_id=post_id, talk_id=talk_id, ip_hash=who.ip_hash, region_name=region_name, body=body))
|
||||
s.add(c)
|
||||
await s.execute(update(Post).where(Post.post_id == post_id).values(comment_count=Post.comment_count + 1))
|
||||
await _count(s, post_id, talk_id, 1)
|
||||
await s.flush()
|
||||
return c
|
||||
|
||||
@@ -90,14 +102,14 @@ class ReactionCRUD:
|
||||
owner = Comment.user_id == who.user_id if who.user_id is not None else (Comment.user_id.is_(None) & (Comment.ip_hash == who.ip_hash))
|
||||
res = await s.execute(
|
||||
update(Comment).where(Comment.comment_id == comment_id, owner, Comment.deleted.is_(False))
|
||||
.values(deleted=True).returning(Comment.post_id, Comment.is_hidden)
|
||||
.values(deleted=True).returning(Comment.post_id, Comment.talk_id, Comment.is_hidden)
|
||||
)
|
||||
row = res.first()
|
||||
if row is None:
|
||||
return False
|
||||
# 숨긴 댓글은 이미 댓글 수에서 빠져 있다
|
||||
if not row.is_hidden:
|
||||
await s.execute(update(Post).where(Post.post_id == row.post_id).values(comment_count=Post.comment_count - 1))
|
||||
await _count(s, row.post_id, row.talk_id, -1)
|
||||
return True
|
||||
|
||||
async def toggle_comment_like(self, s: AsyncSession, comment_id: int, who: Liker, on: bool) -> Optional[int]:
|
||||
@@ -120,22 +132,22 @@ class ReactionCRUD:
|
||||
await s.execute(update(Comment).where(Comment.comment_id == comment_id).values(report_count=Comment.report_count + 1))
|
||||
res = await s.execute(
|
||||
update(Comment).where(Comment.comment_id == comment_id, Comment.report_count >= HIDE_AT, Comment.is_hidden.is_(False), Comment.deleted.is_(False))
|
||||
.values(is_hidden=True).returning(Comment.post_id)
|
||||
.values(is_hidden=True).returning(Comment.post_id, Comment.talk_id)
|
||||
)
|
||||
post_id = res.scalar()
|
||||
if post_id is not None:
|
||||
await s.execute(update(Post).where(Post.post_id == post_id).values(comment_count=Post.comment_count - 1))
|
||||
row = res.first()
|
||||
if row is not None:
|
||||
await _count(s, row.post_id, row.talk_id, -1)
|
||||
|
||||
async def set_hidden(self, s: AsyncSession, comment_id: int, hidden: bool) -> bool:
|
||||
"""운영자가 댓글을 숨기거나 되살린다. 실제로 바뀌었을 때만 댓글 수를 고친다."""
|
||||
res = await s.execute(
|
||||
update(Comment).where(Comment.comment_id == comment_id, Comment.is_hidden.is_(not hidden), Comment.deleted.is_(False))
|
||||
.values(is_hidden=hidden).returning(Comment.post_id)
|
||||
.values(is_hidden=hidden).returning(Comment.post_id, Comment.talk_id)
|
||||
)
|
||||
post_id = res.scalar()
|
||||
if post_id is None:
|
||||
row = res.first()
|
||||
if row is None:
|
||||
return False
|
||||
await s.execute(update(Post).where(Post.post_id == post_id).values(comment_count=Post.comment_count + (-1 if hidden else 1)))
|
||||
await _count(s, row.post_id, row.talk_id, -1 if hidden else 1)
|
||||
return True
|
||||
|
||||
async def block(self, s: AsyncSession, user_id: uuid.UUID, blocked_id: uuid.UUID) -> None:
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import Optional
|
||||
from sqlalchemy import delete, func, select, update
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.database.model.models import Comment, CommentLike, CommentReport, PointLog, Post, PostLike, PostSave, User, UserBlock
|
||||
from common.database.model.models import Comment, CommentLike, CommentReport, PointLog, Post, PostLike, PostSave, Talk, User, UserBlock
|
||||
|
||||
|
||||
class UserCRUD:
|
||||
@@ -74,12 +74,17 @@ class UserCRUD:
|
||||
if reported:
|
||||
await s.execute(update(Comment).where(Comment.comment_id.in_(reported)).values(report_count=Comment.report_count - 1))
|
||||
await s.execute(delete(UserBlock).where((UserBlock.user_id == user_id) | (UserBlock.blocked_id == user_id)))
|
||||
mine = (await s.execute(delete(Comment).where(Comment.user_id == user_id).returning(Comment.comment_id, Comment.post_id, Comment.deleted, Comment.is_hidden))).all()
|
||||
mine = (await s.execute(
|
||||
delete(Comment).where(Comment.user_id == user_id).returning(Comment.comment_id, Comment.post_id, Comment.talk_id, Comment.deleted, Comment.is_hidden)
|
||||
)).all()
|
||||
if mine:
|
||||
ids = [c for c, _, _, _ in mine]
|
||||
ids = [c for c, *_ in mine]
|
||||
await s.execute(delete(CommentLike).where(CommentLike.comment_id.in_(ids)))
|
||||
await s.execute(delete(CommentReport).where(CommentReport.comment_id.in_(ids)))
|
||||
# 이미 지웠거나 숨긴 댓글은 댓글 수에서 빠져 있다
|
||||
for post_id, n in Counter(p for _, p, deleted, hidden in mine if not deleted and not hidden).items():
|
||||
shown = [(p, t) for _, p, t, deleted, hidden in mine if not deleted and not hidden]
|
||||
for post_id, n in Counter(p for p, t in shown if t is None).items():
|
||||
await s.execute(update(Post).where(Post.post_id == post_id).values(comment_count=Post.comment_count - n))
|
||||
for talk_id, n in Counter(t for _, t in shown if t is not None).items():
|
||||
await s.execute(update(Talk).where(Talk.talk_id == talk_id).values(comment_count=Talk.comment_count - n))
|
||||
await s.execute(delete(User).where(User.user_id == user_id))
|
||||
@@ -378,6 +378,11 @@ CREATE INDEX IF NOT EXISTS idx_talk_user_day ON public.talk (user_id, created_at
|
||||
-- 글 주제 (TalkTopic: 1 동네 이야기, 2 하늘·노을, 3 비·눈, 4 단풍·꽃, 5 오늘 옷차림)
|
||||
ALTER TABLE public.talk ADD COLUMN IF NOT EXISTS topic SMALLINT NOT NULL DEFAULT 1;
|
||||
CREATE INDEX IF NOT EXISTS idx_talk_recent ON public.talk (created_at DESC) WHERE deleted = FALSE AND hidden = FALSE;
|
||||
-- 사람 글 댓글은 comment 표를 같이 쓰고 talk_id 로 가른다 (post_id 는 비움). 숨긴 댓글은 댓글 수에서 빠진다
|
||||
ALTER TABLE public.talk ADD COLUMN IF NOT EXISTS comment_count INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE public.comment ALTER COLUMN post_id DROP NOT NULL;
|
||||
ALTER TABLE public.comment ADD COLUMN IF NOT EXISTS talk_id BIGINT NULL;
|
||||
CREATE INDEX IF NOT EXISTS idx_comment_talk ON public.comment (talk_id, created_at) WHERE deleted = FALSE AND talk_id IS NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.talk_like (
|
||||
talk_id BIGINT NOT NULL,
|
||||
|
||||
@@ -24,6 +24,12 @@ def _comment(v: CommentView) -> CommentData:
|
||||
return CommentData(comment_id=c.comment_id, nickname=v.nickname, character=v.character, color=v.color, mood=v.mood, body=c.body, like_count=c.like_count, liked=v.liked, mine=v.mine, official=v.official, created_at=c.created_at.astimezone(KST))
|
||||
|
||||
|
||||
def _comment_list(err: ErrorType, items: list[CommentView]) -> Res_CommentList:
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_CommentList(result=error_info(err))
|
||||
return Res_CommentList(comments=[_comment(v) for v in items], next_cursor=items[-1].comment.comment_id if len(items) == PAGE else None)
|
||||
|
||||
|
||||
async def _like(post_id: int, who: Liker, on: bool, service: ReactionService) -> Res_PostLike:
|
||||
err, count = await service.like_post(post_id, who, on)
|
||||
return Res_PostLike(result=error_info(err)) if err is not ErrorType.SUCCESS else Res_PostLike(liked=on, like_count=count)
|
||||
@@ -65,10 +71,7 @@ async def list_comments(
|
||||
post_id: int = Path(...), cursor: Optional[int] = Query(None), user: Optional[User] = Depends(optional_user), who: Liker = Depends(liker),
|
||||
service: ReactionService = Depends(),
|
||||
) -> Res_CommentList:
|
||||
err, items = await service.comments(post_id, user, who.ip_hash, cursor)
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return Res_CommentList(result=error_info(err))
|
||||
return Res_CommentList(comments=[_comment(v) for v in items], next_cursor=items[-1].comment.comment_id if len(items) == PAGE else None)
|
||||
return _comment_list(*await service.comments(post_id, user, who.ip_hash, cursor))
|
||||
|
||||
|
||||
@router.post("/post/{post_id}/comment", response_model=Res_Comment, response_model_exclude_none=True, summary="댓글 쓰기 (60자, 로그인 없으면 '동네 익명'으로 IP 당 하루 20개, 로그인했는데 이용약관 동의 전이면 TERMS_REQUIRED)")
|
||||
@@ -79,6 +82,22 @@ async def add_comment(
|
||||
return Res_Comment(result=error_info(err)) if err is not ErrorType.SUCCESS else Res_Comment(comment=_comment(v))
|
||||
|
||||
|
||||
@router.get("/talk/{talk_id}/comment/list", response_model=Res_CommentList, response_model_exclude_none=True, summary="사람 글 댓글 목록 (로그인 없이 보기)")
|
||||
async def list_talk_comments(
|
||||
talk_id: int = Path(...), cursor: Optional[int] = Query(None), user: Optional[User] = Depends(optional_user), who: Liker = Depends(liker),
|
||||
service: ReactionService = Depends(),
|
||||
) -> Res_CommentList:
|
||||
return _comment_list(*await service.comments(None, user, who.ip_hash, cursor, talk_id))
|
||||
|
||||
|
||||
@router.post("/talk/{talk_id}/comment", response_model=Res_Comment, response_model_exclude_none=True, summary="사람 글 댓글 쓰기 (로그인한 사람만, 60자, 링크·전화번호 불가, 이용약관 동의 전이면 TERMS_REQUIRED). 지우기·좋아요·신고·차단은 /comment/{comment_id} 그대로")
|
||||
async def add_talk_comment(
|
||||
talk_id: int = Path(...), req: Req_Comment = ..., user: User = Depends(current_user), who: Liker = Depends(liker), service: ReactionService = Depends(),
|
||||
) -> Res_Comment:
|
||||
err, v = await service.add_talk_comment(talk_id, user, who, req.body)
|
||||
return Res_Comment(result=error_info(err)) if err is not ErrorType.SUCCESS else Res_Comment(comment=_comment(v))
|
||||
|
||||
|
||||
@router.delete("/comment/{comment_id}", response_model=Res_WebPacketProtocol, response_model_exclude_none=True, summary="내 댓글 지우기 (로그인 없이 쓴 댓글은 같은 IP 에서)")
|
||||
async def delete_comment(comment_id: int = Path(...), who: Liker = Depends(liker), service: ReactionService = Depends()) -> Res_WebPacketProtocol:
|
||||
return Res_WebPacketProtocol(result=error_info(await service.delete_comment(comment_id, who)))
|
||||
|
||||
@@ -19,6 +19,7 @@ class TalkData(WebPacketProtocol):
|
||||
image: Optional[str] = Field(None, description="올린 사진 주소")
|
||||
topic: TalkTopic = TalkTopic.LOCAL
|
||||
like_count: int
|
||||
comment_count: int = 0
|
||||
liked: bool
|
||||
mine: bool
|
||||
created_at: datetime
|
||||
|
||||
@@ -23,7 +23,7 @@ def _data(v: TalkView) -> TalkData:
|
||||
t, u = v.talk, v.author
|
||||
return TalkData(
|
||||
talk_id=t.talk_id, nickname=u.nickname, character=u.character, color=u.color, mood=u.mood, region_name=v.region_name, weather=t.weather,
|
||||
body=t.body, image=t.image, topic=TalkTopic(t.topic), like_count=t.like_count, liked=v.liked, mine=v.mine, created_at=t.created_at.astimezone(KST),
|
||||
body=t.body, image=t.image, topic=TalkTopic(t.topic), like_count=t.like_count, comment_count=t.comment_count, liked=v.liked, mine=v.mine, created_at=t.created_at.astimezone(KST),
|
||||
ago=ago_text(t.created_at, now_kst()),
|
||||
)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ from common.cache.lock import redis_lock
|
||||
from common.cache.redis_client import REDIS
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import Article, CardSet, IndexScore, OpenMeteoHourly, Post, Region, WeatherHourly
|
||||
from common.enums import AirGrade, ArticleCategory, ErrorType, PostType, RainType, RefType, Sky, SkyGrade, SkySituation, SkyType, WarningType
|
||||
from common.enums import AirGrade, ArticleCategory, ErrorType, EventKind, PostType, RainType, RefType, Sky, SkyGrade, SkySituation, SkyType, WarningType
|
||||
from common.logger import LOG
|
||||
from common.utils.kma_time import KST, ULTRA_DELAY, kst_midnight, latest_ultra_base, next_vilage_available, now_kst
|
||||
from common.utils.text import compass, day_range, hour_label, short_day
|
||||
@@ -43,6 +43,9 @@ from services.week_service import DayPlan, EventItem, WeekService, image_credit,
|
||||
from services.weekend_plan import day_plan, forecast, pick_events
|
||||
from services.weekend_rank import TripPick, WeekendRank, pick_trip, weekend_days
|
||||
|
||||
# 행사 포스트: 축제는 전부, 팝업·전시·콘서트는 종류마다 이만큼. 자리는 _EVENT_SLOTS 개까지
|
||||
_EVENT_OTHERS = 2
|
||||
_EVENT_SLOTS = 40
|
||||
# 그날 피드 카드: (번호, 종류, 참조, 지수 순위). 03:00 에 전부 만들고, 볼 때 시간대에 따라 켜고 끄고 순서를 정한다 (docs/서비스_동작_안내.md).
|
||||
LINEUP = [
|
||||
(1, PostType.WEATHER, RefType.NONE, None),
|
||||
@@ -70,6 +73,7 @@ LINEUP = [
|
||||
(23, PostType.FOLIAGE, RefType.NONE, None),
|
||||
(24, PostType.EVENTS_BAND, RefType.NONE, None),
|
||||
(25, PostType.SEASON_BAND, RefType.NONE, None),
|
||||
*((22 + rank, PostType.EVENT, RefType.NONE, rank) for rank in range(4, _EVENT_SLOTS + 1)),
|
||||
]
|
||||
# 피드 목록 대신 히어로·오늘의 각·단풍 지도·띠에 좋아요·댓글만 붙는 자리
|
||||
_PINNED = {
|
||||
@@ -237,9 +241,12 @@ def arrange(cards: list[PostData], slot: str, now: datetime, sunset_at: datetime
|
||||
rest = [c for c in rest if c.post_type is not PostType.QUOTE] + [c for c in rest if c.post_type is PostType.QUOTE]
|
||||
events = pool.get(PostType.EVENT, [])
|
||||
front = range(1, max(1, len(rest) // 2 + 1))
|
||||
gaps = sorted(random.Random(seed).sample(front, min(len(events), len(front))), reverse=True)
|
||||
# 앞쪽 절반에 다 못 들어가면 끝까지 한 장씩 걸러 끼우고, 그래도 남은 행사는 맨 뒤에
|
||||
gaps = (sorted(random.Random(seed).sample(front, len(events)), reverse=True) if len(events) <= len(front)
|
||||
else list(range(min(len(events), len(rest)), 0, -1)))
|
||||
for gap, e in zip(gaps, reversed(events[:len(gaps)])):
|
||||
rest.insert(gap, e)
|
||||
rest += events[len(gaps):]
|
||||
# 카드뉴스(관리자가 올린 것)는 날씨 바로 아래, 같은 날 두 번째부터는 피드 중간쯤
|
||||
cards = pool.get(PostType.CARD, [])
|
||||
for i, card in enumerate(cards[1:]):
|
||||
@@ -537,7 +544,7 @@ class FeedService:
|
||||
slides=[RowsSlide(kind="rows", eyebrow=_CATEGORY_META[a.category], line=a.body[0], icon=a.icon, image=a.image_url, image_credit=a.image_credit)],
|
||||
share_messages=[a.title])
|
||||
if t is PostType.EVENT:
|
||||
soon = mix_kinds([e for e in c.events if e.event.start_date <= c.now.date() + timedelta(days=7) and e.event.end_date >= c.now.date()])
|
||||
soon = feed_events([e for e in c.events if e.event.start_date <= c.now.date() + timedelta(days=7) and e.event.end_date >= c.now.date()])
|
||||
rank = p.index_rank or 1
|
||||
if len(soon) < rank:
|
||||
return None
|
||||
@@ -811,6 +818,18 @@ def _temp_change(today: Optional[TodayWeather], tomorrow: Optional[TodayWeather]
|
||||
return f"내일 낮 최고 {round(highs[1])}°, 오늘보다 {abs(diff)}° {'더워요' if diff > 0 else '쌀쌀해요'}."
|
||||
|
||||
|
||||
def feed_events(items: list[EventItem]) -> list[EventItem]:
|
||||
"""피드에 포스트로 올릴 행사. 축제는 전부, 다른 종류는 받은 순서대로 _EVENT_OTHERS 개씩 골라 종류를 돌아가며 섞는다."""
|
||||
taken: dict[int, int] = {}
|
||||
picked = []
|
||||
for e in items:
|
||||
n = taken.get(e.event.kind, 0)
|
||||
if e.event.kind == EventKind.FESTIVAL or n < _EVENT_OTHERS:
|
||||
picked.append(e)
|
||||
taken[e.event.kind] = n + 1
|
||||
return mix_kinds(picked)
|
||||
|
||||
|
||||
def _event_caption(e: EventItem) -> str:
|
||||
"""진행 상태·거리·그날 날씨 중 있는 것. 다 없으면 일정 확정 여부."""
|
||||
parts = ["지금 진행 중" if e.status == "live" else e.status_label]
|
||||
|
||||
@@ -13,6 +13,7 @@ from common.utils.kma_time import kst_midnight, now_kst
|
||||
from crud.feed_crud import FeedCRUD
|
||||
from crud.reaction_crud import ReactionCRUD
|
||||
from crud.region_crud import RegionCRUD
|
||||
from crud.talk_crud import TalkCRUD
|
||||
from services.bot_comment import BOT_COLORS, BOT_NAMES
|
||||
from services.level_service import award
|
||||
from services.talk_service import _LINK, _PHONE
|
||||
@@ -43,8 +44,10 @@ class SavedView:
|
||||
|
||||
|
||||
class ReactionService:
|
||||
def __init__(self, crud: ReactionCRUD = Depends(ReactionCRUD), feed: FeedCRUD = Depends(FeedCRUD), regions: RegionCRUD = Depends(RegionCRUD)) -> None:
|
||||
self.crud, self.feed, self.regions = crud, feed, regions
|
||||
def __init__(
|
||||
self, crud: ReactionCRUD = Depends(ReactionCRUD), feed: FeedCRUD = Depends(FeedCRUD), regions: RegionCRUD = Depends(RegionCRUD), talks: TalkCRUD = Depends(TalkCRUD),
|
||||
) -> None:
|
||||
self.crud, self.feed, self.regions, self.talks = crud, feed, regions, talks
|
||||
|
||||
async def _post_exists(self, post_id: int) -> ErrorType:
|
||||
err, post = await DB_SESSION_MNG.execute_lambda(lambda s: self.feed.get(s, post_id))
|
||||
@@ -100,8 +103,9 @@ class ReactionService:
|
||||
return CommentView(comment=c, nickname=f"{c.region_name} 익명" if c.region_name else "익명", character=ANON_CHARACTER, color=ANON_COLOR, mood=None, liked=liked, mine=mine)
|
||||
return CommentView(comment=c, nickname=nickname or "", character=character or ANON_CHARACTER, color=color or ANON_COLOR, mood=mood, liked=liked, mine=c.user_id == who.user_id)
|
||||
|
||||
async def comments(self, post_id: int, user: Optional[User], ip_hash: str, cursor: Optional[int]) -> tuple[ErrorType, list[CommentView]]:
|
||||
err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.comments(s, post_id, user.user_id if user else None, cursor, PAGE))
|
||||
async def comments(self, post_id: Optional[int], user: Optional[User], ip_hash: str, cursor: Optional[int], talk_id: Optional[int] = None) -> tuple[ErrorType, list[CommentView]]:
|
||||
"""포스트 댓글, talk_id 가 있으면 그 사람 글의 댓글."""
|
||||
err, rows = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.comments(s, post_id, user.user_id if user else None, cursor, PAGE, talk_id))
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return err, []
|
||||
liked: set[int] = set()
|
||||
@@ -146,6 +150,26 @@ class ReactionService:
|
||||
await award(user.user_id, "react", f"comment:{c.comment_id}")
|
||||
return err, self._view(c, user.nickname, user.character, user.color, user.mood, False, who)
|
||||
|
||||
async def add_talk_comment(self, talk_id: int, user: User, who: Liker, body: str) -> tuple[ErrorType, Optional[CommentView]]:
|
||||
"""사람 글 댓글은 로그인한 사람만 쓴다. 글처럼 링크·전화번호는 막는다."""
|
||||
body = body.strip()
|
||||
if not body or len(body) > COMMENT_MAX:
|
||||
return ErrorType.INVALID_INPUT, None
|
||||
if user.terms_agreed_at is None:
|
||||
return ErrorType.TERMS_REQUIRED, None
|
||||
if _LINK.search(body) or _PHONE.search(body):
|
||||
return ErrorType.LINK_NOT_ALLOWED, None
|
||||
err, talk = await DB_SESSION_MNG.execute_lambda(lambda s: self.talks.get(s, talk_id))
|
||||
if err is not ErrorType.SUCCESS:
|
||||
return err, None
|
||||
if talk is None or talk.hidden:
|
||||
return ErrorType.NOT_FOUND, None
|
||||
err, c = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.add_comment(s, None, who, body, None, talk_id))
|
||||
if c is None:
|
||||
return err, None
|
||||
await award(user.user_id, "react", f"comment:{c.comment_id}")
|
||||
return err, self._view(c, user.nickname, user.character, user.color, user.mood, False, who)
|
||||
|
||||
async def delete_comment(self, comment_id: int, who: Liker) -> ErrorType:
|
||||
err, ok = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.delete_comment(s, comment_id, who))
|
||||
if err is not ErrorType.SUCCESS:
|
||||
|
||||
@@ -195,6 +195,49 @@ def test_arrange_scatters_up_to_three_events_same_spot_all_day():
|
||||
assert run(14, "2026-10-02:1144000000") == out
|
||||
|
||||
|
||||
def test_feed_events_keeps_every_festival_and_two_of_other_kinds():
|
||||
from types import SimpleNamespace
|
||||
|
||||
from common.enums import EventKind
|
||||
from services.feed_service import feed_events
|
||||
from services.week_service import EventItem
|
||||
|
||||
kinds = [EventKind.POPUP] * 4 + [EventKind.FESTIVAL] * 6 + [EventKind.CONCERT] * 3 + [EventKind.EXHIBITION] * 3
|
||||
items = [EventItem(event=SimpleNamespace(kind=k.value, n=n), status="live", status_label="진행 중", fit=None) for n, k in enumerate(kinds)]
|
||||
out = [e.event.kind for e in feed_events(items)]
|
||||
assert out.count(EventKind.FESTIVAL.value) == 6
|
||||
assert all(out.count(k.value) == 2 for k in (EventKind.POPUP, EventKind.CONCERT, EventKind.EXHIBITION))
|
||||
assert out[:4] == [EventKind.FESTIVAL.value, EventKind.POPUP.value, EventKind.EXHIBITION.value, EventKind.CONCERT.value]
|
||||
|
||||
|
||||
def test_arrange_spreads_many_events_through_whole_feed():
|
||||
"""행사가 앞쪽 절반 자리보다 많으면 끝까지 한 장씩 걸러 끼우고, 남은 건 맨 뒤에 다 붙인다."""
|
||||
from datetime import datetime
|
||||
|
||||
from common.utils.kma_time import KST
|
||||
from services.feed_service import arrange
|
||||
|
||||
sunset = datetime(2026, 10, 2, 18, 10, tzinfo=KST)
|
||||
others = [PostType.WEATHER, PostType.GAK, PostType.GAK, PostType.GAK, PostType.SUNSET, PostType.WEEK, PostType.SEASON, PostType.TIP, PostType.QUOTE]
|
||||
cards = [_card(t, n) for n, t in enumerate(others + [PostType.EVENT] * 20)]
|
||||
out = arrange(cards, "day", datetime(2026, 10, 2, 13, tzinfo=KST), sunset, False, "2026-10-02:1144000000")
|
||||
types = [c.post_type for c in out]
|
||||
assert types.count(PostType.EVENT) == 20 and types[0] is PostType.WEATHER
|
||||
rest = len(others) - 1
|
||||
assert PostType.EVENT not in types[1:1 + 2 * rest:2] and types[2:2 + 2 * rest:2] == [PostType.EVENT] * rest
|
||||
assert set(types[1 + 2 * rest:]) == {PostType.EVENT}
|
||||
assert [c.post_id for c in out if c.post_type is PostType.EVENT] == list(range(len(others), len(others) + 20))
|
||||
|
||||
|
||||
def test_lineup_event_slots_stay_below_card_positions():
|
||||
from crud.card_crud import CARD_POSITION_START
|
||||
from services.feed_service import LINEUP, _EVENT_SLOTS
|
||||
|
||||
positions = [x[0] for x in LINEUP]
|
||||
assert len(positions) == len(set(positions)) and max(positions) < CARD_POSITION_START
|
||||
assert sorted(x[3] for x in LINEUP if x[1] is PostType.EVENT) == list(range(1, _EVENT_SLOTS + 1))
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_build_day_makes_every_card_at_three():
|
||||
thursday = date(2026, 10, 15)
|
||||
|
||||
@@ -82,6 +82,32 @@ async def test_reports_hide_and_block_hides_author():
|
||||
assert t["talk_id"] not in [x["talk_id"] for x in (await c.get("/v1/talk/list")).json()["talks"]]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_talk_comments_need_login_and_keep_count_on_talk():
|
||||
async with client() as c:
|
||||
h = await _login(c, "talk_c1")
|
||||
t = (await _write(c, h))["talk"]
|
||||
url = f"/v1/reaction/talk/{t['talk_id']}/comment"
|
||||
count = lambda talks: next(x for x in talks if x["talk_id"] == t["talk_id"])["comment_count"] # noqa: E731
|
||||
assert (await c.post(url, json={"body": "저도 봤어요"})).status_code == 401
|
||||
other = await _login(c, "talk_c2")
|
||||
assert (await c.post(url, headers=other, json={"body": "저도 봤어요"})).json()["result"]["desc"] == "TERMS_REQUIRED"
|
||||
await c.post("/v1/auth/terms", headers=other)
|
||||
assert (await c.post(url, headers=other, json={"body": "연락 010-1234-5678"})).json()["result"]["desc"] == "LINK_NOT_ALLOWED"
|
||||
assert (await c.post(url, headers=other, json={"body": "가" * 61})).json()["result"]["desc"] == "INVALID_INPUT"
|
||||
|
||||
made = (await c.post(url, headers=other, json={"body": " 저도 봤어요 "})).json()["comment"]
|
||||
assert made["body"] == "저도 봤어요" and made["mine"] is True
|
||||
listed = (await c.get(f"{url}/list")).json()["comments"]
|
||||
assert [x["comment_id"] for x in listed] == [made["comment_id"]] and listed[0]["nickname"] == "talk_c2"
|
||||
assert count((await c.get("/v1/talk/list")).json()["talks"]) == 1
|
||||
|
||||
assert (await c.delete(f"/v1/reaction/comment/{made['comment_id']}", headers=other)).json()["result"]["success"] is True
|
||||
assert (await c.get(f"{url}/list")).json()["comments"] == []
|
||||
assert count((await c.get("/v1/talk/list")).json()["talks"]) == 0
|
||||
assert (await c.post("/v1/reaction/talk/999999999/comment", headers=other, json={"body": "안녕"})).json()["result"]["desc"] == "NOT_FOUND"
|
||||
|
||||
|
||||
def test_weather_line():
|
||||
class Row:
|
||||
temp_c, sky, rain_type = 18.4, 1, 1
|
||||
|
||||
@@ -38,10 +38,12 @@ GA4 태그(`gtag.js`, 측정 ID `G-D378J4X373`)를 `index.html`에 심고, 화
|
||||
| `sheet_open` | 아래에서 올라오는 창이 열림 (각·글·보내기·댓글·로그인·내 정보·지역·내 각·홈 화면 추가·점수 근거·이야기 등) | `sheet`(창 종류: `gak`·`article`·`share`·`comments`·`login`·`me`·`region`·`mix`·`myGak`·`install`·`weatherWhy`·`talk`·`seasonWeek`) | `Sheets.tsx` `SheetProvider` `open` |
|
||||
| `like` | 좋아요 성공 (취소는 안 보냄) | `content_type: 'post' \| 'comment' \| 'talk' \| 'hero_post' \| 'gak_post' \| 'foliage_post' \| 'events_post' \| 'season_post'`, `item_id`(포스트·댓글·글 번호) | `Post.tsx` `FullCard`, `pinnedLike.ts`, `Sheets.tsx` `CommentRow`, `talk.tsx` |
|
||||
| `comment` | 댓글 올리기 성공 | `post_id` | `Sheets.tsx` `CommentsSheet` `send` |
|
||||
| `talk_comment` | 사람 글에 댓글 올리기 성공 (로그인한 사람만) | `talk_id`(글 번호) | `Sheets.tsx` `CommentsSheet` `send` |
|
||||
| `terms_agree` | 댓글 쓰기 전 이용약관 동의 성공 | 없음 | `Sheets.tsx` `CommentsSheet` `agreeAndSend` |
|
||||
| `report` | 신고 성공 | `content_type: 'comment' \| 'talk'`, `reason`(신고 이유 번호) | `Sheets.tsx` `CommentMenu`, `talk.tsx` |
|
||||
| `block` | 차단 성공 | `content_type: 'comment' \| 'talk'` | `Sheets.tsx` `CommentMenu`, `talk.tsx` |
|
||||
| `talk_post` | 이야기 글 올리기 성공 | `topic`(주제 번호), `with_image` | `talk.tsx` 글쓰기 `submit` |
|
||||
| `feed_item_view` | 오늘 피드에 섞인 사람 글·행사 포스트가 처음 반쯤 보임 (한 장에 한 번) | `item_type: 'talk' \| 'event'`, `position`(피드에서 그 종류의 몇 번째) | `TodayPage.tsx` `Seen` |
|
||||
| `hero_day_switch` | 히어로 오늘/내일 스위치를 바꿈 | `day: 'today' \| 'tomorrow'` | `TodayPage.tsx` |
|
||||
| `shorts_open` | 쇼츠 페이지(/shorts/영상ID)로 들어옴 (오늘 화면 쇼츠 줄·공유 링크) | `video_id` | `Shorts.tsx` `ShortsPage` |
|
||||
| `shorts_view` | 쇼츠를 넘겨 다른 영상으로 감 | `video_id`, `index`(목록 순서) | `Shorts.tsx` `ShortsPage` |
|
||||
|
||||
+56
-29
@@ -5,6 +5,7 @@ import { clearTokens, setTokens, subscribeAuth } from '@nalssigak/shared/api/aut
|
||||
import { SITE_URL } from '../api/setup'
|
||||
import {
|
||||
addCommentMutation,
|
||||
addTalkCommentMutation,
|
||||
agreeTermsMutation,
|
||||
blockAuthorMutation,
|
||||
deleteCommentMutation,
|
||||
@@ -14,6 +15,8 @@ import {
|
||||
getSeasonWeekOptions,
|
||||
likeCommentMutation,
|
||||
listCommentsInfiniteOptions,
|
||||
listTalkCommentsInfiniteOptions,
|
||||
listTalkCommentsInfiniteQueryKey,
|
||||
listBlockedOptions,
|
||||
listBlockedQueryKey,
|
||||
listCommentsInfiniteQueryKey,
|
||||
@@ -44,9 +47,9 @@ import { WeatherWhySheet } from './weatherWhy'
|
||||
import { useSky } from './skyContext'
|
||||
import { LEVELS } from './cloudMerge'
|
||||
import { SHARE_SIZES, shareImage, type ShareSize } from './storyImage'
|
||||
import { SheetContext, useSheet, type SharePayload, type SheetState } from './sheetContext'
|
||||
import { SheetContext, useSheet, type CommentTarget, type SharePayload, type SheetState } from './sheetContext'
|
||||
import { HeartIcon } from './svg'
|
||||
import { MyTalks, TalkSheet } from './talk'
|
||||
import { MyTalks } from './talk'
|
||||
import { Avatar, Ic, Skel, StateBox, TAP44, Thumb } from './ui'
|
||||
|
||||
export function SheetProvider({ children }: { children: ReactNode }) {
|
||||
@@ -169,7 +172,7 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void
|
||||
{shown.type === 'article' && <ArticleSheet articleId={shown.articleId} onTitle={setArticleTitle} />}
|
||||
{shown.type === 'seasonWeek' && <SeasonWeekSheet />}
|
||||
{shown.type === 'share' && <ShareSheet share={shown.share} />}
|
||||
{shown.type === 'comments' && <CommentsSheet postId={shown.postId} draft={shown.draft} />}
|
||||
{shown.type === 'comments' && <CommentsSheet to={shown} draft={shown.draft} />}
|
||||
{shown.type === 'login' && <LoginSheet onDone={onClose} onLoggedIn={then ? () => open(then) : onClose} why={shown.why} />}
|
||||
{shown.type === 'me' && <MeSheet onDone={onClose} />}
|
||||
{shown.type === 'region' && <RegionSheet onDone={onClose} />}
|
||||
@@ -180,7 +183,6 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void
|
||||
{shown.type === 'tarot' && <TarotSheet />}
|
||||
{shown.type === 'level' && <LevelSheet />}
|
||||
{shown.type === 'levelUp' && <LevelUpSheet level={shown.level} />}
|
||||
{shown.type === 'talk' && <TalkSheet talk={shown.talk} />}
|
||||
{shown.type === 'gameHelp' && <GameHelpSheet />}
|
||||
</div>
|
||||
)}
|
||||
@@ -725,7 +727,7 @@ const REPORT_REASONS = [
|
||||
const isCommentList = (q: { queryKey: readonly unknown[] }) => (q.queryKey[0] as { _id?: string } | undefined)?._id === 'listComments'
|
||||
|
||||
/** 남의 댓글: ⋯ → 신고하기(이유 고르기) / 이 사람 차단하기(한 번 더 묻기). 끝나면 목록을 다시 받아 그 댓글이 빠진다 */
|
||||
function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number; onNotice: (text: string) => void }) {
|
||||
function CommentMenu({ c, to, onNotice }: { c: CommentData; to: CommentTarget; onNotice: (text: string) => void }) {
|
||||
const { loggedIn } = useAuth()
|
||||
const { open } = useSheet()
|
||||
const queryClient = useQueryClient()
|
||||
@@ -748,7 +750,7 @@ function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number;
|
||||
})
|
||||
const go = (next: typeof step) => {
|
||||
setFailed(false)
|
||||
if (next !== 'closed' && !loggedIn) return open({ type: 'login', then: { type: 'comments', postId } })
|
||||
if (next !== 'closed' && !loggedIn) return open({ type: 'login', then: { type: 'comments', ...to } })
|
||||
setStep(next)
|
||||
}
|
||||
const btn = 'cursor-pointer rounded-[12px] bg-[#f3f6fb] px-3 py-2 text-[13px] font-extrabold text-(--ink) disabled:opacity-50'
|
||||
@@ -798,7 +800,7 @@ function CommentMenu({ c, postId, onNotice }: { c: CommentData; postId: number;
|
||||
)
|
||||
}
|
||||
|
||||
function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; onNotice: (text: string) => void }) {
|
||||
function CommentRow({ c, to, onNotice }: { c: CommentData; to: CommentTarget; onNotice: (text: string) => void }) {
|
||||
const { region } = useRegion()
|
||||
const queryClient = useQueryClient()
|
||||
const [liked, setLiked] = useState(c.liked)
|
||||
@@ -831,7 +833,7 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
}
|
||||
revert()
|
||||
// 그 사이 지워진 댓글이면 알림 없이 목록을 다시 받아 사라지게 한다
|
||||
if (res.result?.code === NOT_FOUND) queryClient.invalidateQueries({ queryKey: listCommentsInfiniteQueryKey({ path: { post_id: postId } }) })
|
||||
if (res.result?.code === NOT_FOUND) queryClient.invalidateQueries({ queryKey: commentListKey(to) })
|
||||
else setLikeFailed(true)
|
||||
},
|
||||
onError: () => {
|
||||
@@ -850,7 +852,7 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
{
|
||||
onSuccess: async (res) => {
|
||||
if (!res.result?.success) return setRemoveFailed(true)
|
||||
const key = listCommentsInfiniteQueryKey({ path: { post_id: postId } })
|
||||
const key = commentListKey(to)
|
||||
await queryClient.cancelQueries({ queryKey: key })
|
||||
queryClient.setQueryData<InfiniteData<ResCommentList>>(key, (data) =>
|
||||
data ? { ...data, pages: data.pages.map((p) => ({ ...p, comments: p.comments?.filter((x) => x.comment_id !== c.comment_id) })) } : data,
|
||||
@@ -883,7 +885,7 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
</>
|
||||
)}
|
||||
{/* 날씨각 캐릭터 댓글은 운영 문구라 신고·차단 메뉴가 없다 */}
|
||||
{!c.mine && !c.official && <CommentMenu c={c} postId={postId} onNotice={onNotice} />}
|
||||
{!c.mine && !c.official && <CommentMenu c={c} to={to} onNotice={onNotice} />}
|
||||
</small>
|
||||
</div>
|
||||
<button type="button" onClick={toggle} aria-pressed={liked} aria-label="댓글 좋아요" className={cx('relative cursor-pointer pt-1', TAP44)}>
|
||||
@@ -893,16 +895,36 @@ function CommentRow({ c, postId, onNotice }: { c: CommentData; postId: number; o
|
||||
)
|
||||
}
|
||||
|
||||
function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
/** 댓글 목록 캐시 키: 지우기·신고 뒤 다시 받을 때 쓴다 */
|
||||
function commentListKey(to: CommentTarget) {
|
||||
return 'talkId' in to ? listTalkCommentsInfiniteQueryKey({ path: { talk_id: to.talkId } }) : listCommentsInfiniteQueryKey({ path: { post_id: to.postId } })
|
||||
}
|
||||
|
||||
/** 포스트 댓글, 또는 사람 글 댓글(로그인한 사람만 쓴다) */
|
||||
function CommentsSheet({ to, draft }: { to: CommentTarget; draft?: string }) {
|
||||
const { region } = useRegion()
|
||||
const { me } = useAuth()
|
||||
const { open } = useSheet()
|
||||
const queryClient = useQueryClient()
|
||||
const list = useInfiniteQuery({
|
||||
...listCommentsInfiniteOptions({ path: { post_id: postId } }),
|
||||
initialPageParam: { path: { post_id: postId } },
|
||||
const talkId = 'talkId' in to ? to.talkId : undefined
|
||||
const postId = 'postId' in to ? to.postId : undefined
|
||||
// 둘 중 하나만 받는다
|
||||
const postList = useInfiniteQuery({
|
||||
...listCommentsInfiniteOptions({ path: { post_id: postId ?? 0 } }),
|
||||
initialPageParam: { path: { post_id: postId ?? 0 } },
|
||||
getNextPageParam: (last) => last.next_cursor ?? undefined,
|
||||
enabled: postId != null,
|
||||
})
|
||||
const add = useMutation(addCommentMutation())
|
||||
const talkList = useInfiniteQuery({
|
||||
...listTalkCommentsInfiniteOptions({ path: { talk_id: talkId ?? 0 } }),
|
||||
initialPageParam: { path: { talk_id: talkId ?? 0 } },
|
||||
getNextPageParam: (last) => last.next_cursor ?? undefined,
|
||||
enabled: talkId != null,
|
||||
})
|
||||
const list = talkId != null ? talkList : postList
|
||||
const addPost = useMutation(addCommentMutation())
|
||||
const addTalk = useMutation(addTalkCommentMutation())
|
||||
const add = { isPending: addPost.isPending || addTalk.isPending }
|
||||
const agree = useMutation(agreeTermsMutation())
|
||||
const [addFailed, setAddFailed] = useState(false)
|
||||
const [askTerms, setAskTerms] = useState(false)
|
||||
@@ -921,26 +943,31 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
const body = text.trim()
|
||||
if (!body || add.isPending) return
|
||||
setAddFailed(false)
|
||||
add.mutate(
|
||||
{ path: { post_id: postId }, body: { body, region: region.code } },
|
||||
{
|
||||
onSuccess: (res) => {
|
||||
if (res.result?.desc === 'TERMS_REQUIRED') return setAskTerms(true)
|
||||
setAddFailed(!res.result?.success)
|
||||
if (!res.result?.success) return
|
||||
const handlers = {
|
||||
onSuccess: (res: { result?: { success?: boolean; desc?: string } }) => {
|
||||
if (res.result?.desc === 'TERMS_REQUIRED') return setAskTerms(true)
|
||||
setAddFailed(!res.result?.success)
|
||||
if (!res.result?.success) return
|
||||
setText('')
|
||||
queryClient.invalidateQueries({ queryKey: commentListKey(to) })
|
||||
if (talkId != null) {
|
||||
track('talk_comment', { talk_id: talkId })
|
||||
queryClient.invalidateQueries({ predicate: (q) => (q.queryKey[0] as { _id?: string } | undefined)?._id === 'listTalks' })
|
||||
} else if (postId != null) {
|
||||
track('comment', { post_id: postId })
|
||||
setText('')
|
||||
queryClient.invalidateQueries({ queryKey: listCommentsInfiniteQueryKey({ path: { post_id: postId } }) })
|
||||
queryClient.invalidateQueries({ queryKey: getFeedQueryKey({ query: { region: region.code } }) })
|
||||
},
|
||||
onError: () => setAddFailed(true),
|
||||
}
|
||||
},
|
||||
)
|
||||
onError: () => setAddFailed(true),
|
||||
}
|
||||
if (talkId != null) addTalk.mutate({ path: { talk_id: talkId }, body: { body } }, handlers)
|
||||
else if (postId != null) addPost.mutate({ path: { post_id: postId }, body: { body, region: region.code } }, handlers)
|
||||
}
|
||||
|
||||
// 로그인했으면 약관에 동의해야 댓글을 쓸 수 있다. 동의하면 쓰던 댓글을 바로 올린다
|
||||
const submit = (e: FormEvent) => {
|
||||
e.preventDefault()
|
||||
if (talkId != null && !me) return open({ type: 'login', then: { type: 'comments', ...to, draft: text } })
|
||||
if (me && !me.terms_agreed) return setAskTerms(true)
|
||||
send()
|
||||
}
|
||||
@@ -967,7 +994,7 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
{comments.length ? (
|
||||
<>
|
||||
{/* 다시 받은 좋아요 상태(로그인 바뀜 등)가 행에 반영되도록 key 에 넣는다 */}
|
||||
{comments.map((c) => <CommentRow key={`${c.comment_id}:${c.liked}:${c.like_count}`} c={c} postId={postId} onNotice={setNotice} />)}
|
||||
{comments.map((c) => <CommentRow key={`${c.comment_id}:${c.liked}:${c.like_count}`} c={c} to={to} onNotice={setNotice} />)}
|
||||
{list.hasNextPage && (
|
||||
<button type="button" onClick={() => list.fetchNextPage()} disabled={list.isFetchingNextPage} className="my-2 w-full cursor-pointer text-center text-sm font-bold text-(--ink3) disabled:opacity-50">
|
||||
{list.isFetchingNextPage ? '불러오는 중…' : '댓글 더 보기'}
|
||||
@@ -1014,7 +1041,7 @@ function CommentsSheet({ postId, draft }: { postId: number; draft?: string }) {
|
||||
{addFailed ? '댓글을 올리지 못했어요. 다시 해 주세요.' : notice}
|
||||
</p>
|
||||
<form onSubmit={submit} className="flex items-center gap-2.5 border-t border-(--line) px-3 pt-2.5 pb-2.5">
|
||||
<input ref={inputRef} value={text} onChange={(e) => setText(e.target.value)} readOnly={add.isPending} maxLength={60} placeholder={me ? `${me.nickname}(으)로 댓글 달기…` : '댓글 달기…'} aria-label="댓글" className="min-w-0 flex-1 rounded-full border border-[#dfe5ee] bg-[#f7f9fc] px-3.5 py-2.5" />
|
||||
<input ref={inputRef} value={text} onChange={(e) => setText(e.target.value)} readOnly={add.isPending} maxLength={60} placeholder={me ? `${me.nickname}(으)로 댓글 달기…` : talkId != null ? '로그인하고 댓글 달기…' : '댓글 달기…'} aria-label="댓글" className="min-w-0 flex-1 rounded-full border border-[#dfe5ee] bg-[#f7f9fc] px-3.5 py-2.5" />
|
||||
<button type="submit" disabled={add.isPending || !text.trim()} className="cursor-pointer font-extrabold text-(--rain) disabled:opacity-40">
|
||||
<Swap labels={['게시', '올리는 중…']} at={add.isPending ? 1 : 0} />
|
||||
</button>
|
||||
|
||||
@@ -6,9 +6,7 @@ import {
|
||||
PostType,
|
||||
RainType,
|
||||
Sky,
|
||||
TalkTopic,
|
||||
type BandArticle,
|
||||
type BandEvent,
|
||||
type Hero as HeroData,
|
||||
type PostReaction,
|
||||
type ResWeatherToday,
|
||||
@@ -18,7 +16,6 @@ import {
|
||||
import { cx } from '../lib/utils'
|
||||
import { cardBg, kindOfHour, kst, type Load, loadOf, MEDALS, type TimeKind, WEEKDAYS } from '@nalssigak/shared/lib'
|
||||
import { fall } from './lib'
|
||||
import { useAuth } from './authContext'
|
||||
import { FoliageCard } from './foliageMap'
|
||||
import { InstallBanner } from './installBanner'
|
||||
import { MoonArt } from './moon'
|
||||
@@ -28,8 +25,8 @@ import { fromShare } from './myGakState'
|
||||
import { PostCard, PostCardSkel, PostFrame } from './Post'
|
||||
import { usePinnedLike } from './pinnedLike'
|
||||
import { ShortsRail } from './Shorts'
|
||||
import { FeedComposer, NearTalks, TalkGroup } from './talk'
|
||||
import { topicName, useTalkGroups, useTodayMyTalks } from './talkState'
|
||||
import { FeedComposer, TalkPost } from './talk'
|
||||
import { useTopicTalks } from './talkState'
|
||||
import { useLandingAbout, useRegion } from './regionContext'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { useSky } from './skyContext'
|
||||
@@ -537,25 +534,6 @@ function Band({ tone, title, sub, to, children }: { tone: 1 | 2 | 3; title: stri
|
||||
)
|
||||
}
|
||||
|
||||
function EventsBand({ events }: { events: BandEvent[] }) {
|
||||
return (
|
||||
<Band tone={1} title="이번 주 가까운 행사" sub="30km 안 · 날씨까지 같이 보고 골라요" to="/week">
|
||||
<Rail>
|
||||
{events.map((e, i) => (
|
||||
<Link key={e.event_id} to="/week" className="w-[200px] overflow-hidden rounded-[22px] bg-white shadow-[inset_0_-5px_0_var(--shade),0_8px_16px_rgb(40_48_74/0.06)]">
|
||||
<Thumb image={e.image} icon={e.icon} credit={e.image_credit} className={cx('h-[116px]', `b-bg-${cardBg(e.icon, i)}`)} iconClassName="w-[76px]">
|
||||
<span className={cx('absolute top-2.5 left-2.5 rounded-full px-2 py-[3px] text-[11.5px] font-extrabold text-white', e.status_label === '진행 중' ? 'bg-[#1f9d62]' : 'bg-(--orange)')}>{e.status_label}</span>
|
||||
</Thumb>
|
||||
<span className="block px-3 pt-2.5 pb-3">
|
||||
<b className="block font-jua text-[16.5px] leading-snug font-normal">{e.name}</b>
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
</Rail>
|
||||
</Band>
|
||||
)
|
||||
}
|
||||
|
||||
function SeasonBand({ news }: { news: BandArticle[] }) {
|
||||
const { open } = useSheet()
|
||||
return (
|
||||
@@ -575,6 +553,29 @@ function SeasonBand({ news }: { news: BandArticle[] }) {
|
||||
)
|
||||
}
|
||||
|
||||
// 사람 글은 포스트 두 장마다 한 장씩 최신순으로 끼운다
|
||||
const TALK_EVERY = 2
|
||||
|
||||
/** 피드에 섞인 사람 글·행사 포스트가 처음 반쯤 보일 때 한 번 GA 로 보낸다 */
|
||||
function Seen({ item, position, children }: { item: 'talk' | 'event'; position: number; children: ReactNode }) {
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
useEffect(() => {
|
||||
const el = ref.current
|
||||
if (!el) return
|
||||
const io = new IntersectionObserver(
|
||||
([e]) => {
|
||||
if (!e.isIntersecting) return
|
||||
track('feed_item_view', { item_type: item, position })
|
||||
io.disconnect()
|
||||
},
|
||||
{ threshold: 0.5 },
|
||||
)
|
||||
io.observe(el)
|
||||
return () => io.disconnect()
|
||||
}, [item, position])
|
||||
return <div ref={ref}>{children}</div>
|
||||
}
|
||||
|
||||
export function TodayPage() {
|
||||
const { region } = useRegion()
|
||||
const about = useLandingAbout()
|
||||
@@ -589,20 +590,10 @@ export function TodayPage() {
|
||||
const bands = f?.bands
|
||||
const nowAt = f?.hero?.now_at
|
||||
const load = loadOf(feed)
|
||||
// 사람 글은 묶음으로: '동네 사람들'은 오늘의 각 아래, 주제 묶음은 같은 주제 포스트 아래. 오늘 쓴 내 글은 글쓰기 칸 아래 '오늘 내 글'에 따로 있으니 빼고
|
||||
const { loggedIn } = useAuth()
|
||||
const mine = useTodayMyTalks(loggedIn)
|
||||
const talkGroups = useTalkGroups()
|
||||
const groupOf = (topic: number) => (talkGroups.groups.get(topic) ?? []).filter((t) => !mine.some((m) => m.talk_id === t.talk_id))
|
||||
const group = (topic: number) => {
|
||||
const talks = groupOf(topic)
|
||||
return talks.length ? <TalkGroup key={`talk-${topic}`} title={topicName(topic)} topic={topic} talks={talks} /> : null
|
||||
}
|
||||
// 비·눈이 오거나 2시간 안에 올 때만 비·눈 묶음을 히어로 바로 아래로
|
||||
const at = nowAt ? Date.parse(nowAt) : 0
|
||||
const nowSlot = (today.data?.slots ?? []).filter((x) => x.temp_c != null).reduce<WeatherSlot | undefined>((a, b) => (!a || Math.abs(Date.parse(b.at) - at) < Math.abs(Date.parse(a.at) - at) ? b : a), undefined)
|
||||
const raining = ['rain', 'snow', 'sleet'].includes(weatherOf(nowSlot)) || !!f?.hero?.will_rain_2h
|
||||
const sunsetAt = posts.findIndex((p) => p.post_type === PostType.SUNSET)
|
||||
const talks = useTopicTalks().talks
|
||||
const talkAt = (i: number) => ((i + 1) % TALK_EVERY === 0 ? talks[(i + 1) / TALK_EVERY - 1] : undefined)
|
||||
const talkFrom = Math.floor(posts.length / TALK_EVERY)
|
||||
const eventNo = new Map(posts.filter((p) => p.post_type === PostType.EVENT).map((p, n) => [p.post_id, n + 1]))
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo({ top: 0 })
|
||||
@@ -619,22 +610,8 @@ export function TodayPage() {
|
||||
if (g) open({ type: 'mix', shared: g })
|
||||
}, [open])
|
||||
|
||||
// 디자인대로 3·6·9번째 글 뒤에 띠를 넣고, 글이 모자라면 남은 띠는 맨 뒤에 붙인다
|
||||
const bandAt: [number, ReactNode][] = [
|
||||
[3, bands?.events?.length ? <EventsBand key="events" events={bands.events} /> : null],
|
||||
[9, bands?.season?.length ? <SeasonBand key="season" news={bands.season} /> : null],
|
||||
]
|
||||
|
||||
// 사람 글 묶음은 포스트 사이사이에 하나씩: 묶음·띠·단풍 카드가 이미 붙는 자리와 바로 앞 자리는 건너뛰어 가로 목록이 연달아 나오지 않게
|
||||
const spreadTopics = [TalkTopic.OUTFIT, ...(raining ? [] : [TalkTopic.RAIN]), ...(sunsetAt < 0 ? [TalkTopic.SKY] : [])].filter((tp) => groupOf(tp).length)
|
||||
const taken = new Set([1, sunsetAt, ...bandAt.map(([at]) => at - 1)])
|
||||
const spreadAt = new Map<number, ReactNode>()
|
||||
let spreadN = 0
|
||||
for (let i = 0; i < posts.length && spreadN < spreadTopics.length; i++) {
|
||||
if (taken.has(i) || spreadAt.has(i - 1)) continue
|
||||
spreadAt.set(i, group(spreadTopics[spreadN++]))
|
||||
}
|
||||
const spreadLeft = spreadTopics.slice(spreadN).map((tp) => group(tp))
|
||||
// 9번째 글 뒤에 계절 이야기 띠를 넣고, 글이 모자라면 맨 뒤에 붙인다
|
||||
const bandAt: [number, ReactNode][] = [[9, bands?.season?.length ? <SeasonBand key="season" news={bands.season} /> : null]]
|
||||
|
||||
return (
|
||||
// 피드 칸은 전국 공통이라 지역이 바뀌어도 글 번호가 같다. 지역마다 새로 그려 넘긴 슬라이드·펼친 상태가 남지 않게 한다
|
||||
@@ -643,8 +620,6 @@ export function TodayPage() {
|
||||
<TodayIcons />
|
||||
<ShortsRail />
|
||||
<FeedComposer />
|
||||
{mine.length > 0 && <TalkGroup title="오늘 내 글" talks={mine} href="/talk?mine=1" />}
|
||||
{raining && group(TalkTopic.RAIN)}
|
||||
<div id={MY_GAK_ID} className="scroll-mt-16">
|
||||
<MyGakRow />
|
||||
</div>
|
||||
@@ -656,7 +631,6 @@ export function TodayPage() {
|
||||
) : (
|
||||
<StateBox load={load} onRetry={() => feed.refetch()} empty="오늘 계산된 각이 없어요." hold={<PostCardSkel />} className="inset-x-3 top-3 bottom-1" />
|
||||
)}
|
||||
<NearTalks talks={groupOf(0)} loaded={talkGroups.loaded} />
|
||||
<InstallBanner />
|
||||
<div>
|
||||
{load === 'loading' && <PostsSkel />}
|
||||
@@ -664,23 +638,36 @@ export function TodayPage() {
|
||||
{load !== 'loading' && !posts.length && (
|
||||
<StateBox load="ready" empty={load === 'ready' ? '오늘 올라온 글이 아직 없어요.' : '글을 불러오지 못했어요.'} hold={<PostsSkel />} className="inset-x-3 top-3.5 bottom-auto" />
|
||||
)}
|
||||
{/* 단풍철엔 단풍 지도를 포스트 맨 앞에, 단풍 이야기 묶음은 바로 아래 */}
|
||||
{load !== 'loading' && posts.length > 0 && (
|
||||
<>
|
||||
<FoliageCard />
|
||||
{group(TalkTopic.FOLIAGE)}
|
||||
</>
|
||||
)}
|
||||
{posts.map((p, i) => (
|
||||
<Fragment key={p.post_id}>
|
||||
<PostCard post={p} />
|
||||
{i === sunsetAt && group(TalkTopic.SKY)}
|
||||
{bandAt.find(([at]) => at === i + 1)?.[1]}
|
||||
{spreadAt.get(i)}
|
||||
</Fragment>
|
||||
))}
|
||||
{/* 글이 모자라 끼울 자리가 없던 묶음은 맨 뒤에 */}
|
||||
{feed.isSuccess && spreadLeft}
|
||||
{/* 단풍철엔 단풍 지도를 포스트 맨 앞에 */}
|
||||
{load !== 'loading' && posts.length > 0 && <FoliageCard />}
|
||||
{posts.map((p, i) => {
|
||||
const t = talkAt(i)
|
||||
const ev = eventNo.get(p.post_id)
|
||||
return (
|
||||
<Fragment key={p.post_id}>
|
||||
{ev ? (
|
||||
<Seen item="event" position={ev}>
|
||||
<PostCard post={p} />
|
||||
</Seen>
|
||||
) : (
|
||||
<PostCard post={p} />
|
||||
)}
|
||||
{bandAt.find(([at]) => at === i + 1)?.[1]}
|
||||
{t && (
|
||||
<Seen item="talk" position={(i + 1) / TALK_EVERY}>
|
||||
<TalkPost t={t} />
|
||||
</Seen>
|
||||
)}
|
||||
</Fragment>
|
||||
)
|
||||
})}
|
||||
{/* 포스트가 모자라 끼울 자리가 없던 사람 글은 맨 뒤에 */}
|
||||
{feed.isSuccess &&
|
||||
talks.slice(talkFrom).map((t, n) => (
|
||||
<Seen key={t.talk_id} item="talk" position={talkFrom + n + 1}>
|
||||
<TalkPost t={t} />
|
||||
</Seen>
|
||||
))}
|
||||
{feed.isSuccess && bandAt.filter(([at]) => at > posts.length).map(([at, node]) => <Fragment key={at}>{node}</Fragment>)}
|
||||
</div>
|
||||
{about && (
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import type { MyGak } from './myGakState'
|
||||
import type { TalkData } from '@nalssigak/shared/api/client/types.gen'
|
||||
import type { WeatherWhyPayload } from './weatherWhy'
|
||||
import { createContext, use } from 'react'
|
||||
/** square: 1:1 비율일 때 slides 대신 찍을 틀 (없으면 slides). url: 같이 보낼 링크 (없으면 사이트 주소) */
|
||||
export type SharePayload = { title: string; slides: HTMLElement[]; square?: HTMLElement[]; url?: string }
|
||||
|
||||
type CommentsState = { type: 'comments'; postId: number; draft?: string }
|
||||
/** 댓글이 달린 곳: 운영 포스트 또는 사람 글 */
|
||||
export type CommentTarget = { postId: number } | { talkId: number }
|
||||
type CommentsState = { type: 'comments'; draft?: string } & CommentTarget
|
||||
|
||||
export type SheetState =
|
||||
| { type: 'gak'; indexId: number }
|
||||
@@ -20,7 +21,6 @@ export type SheetState =
|
||||
| { type: 'myGak'; gak: MyGak; shot?: HTMLElement | null }
|
||||
| { type: 'install' }
|
||||
| { type: 'weatherWhy'; why: WeatherWhyPayload }
|
||||
| { type: 'talk'; talk: TalkData }
|
||||
| { type: 'tarot' }
|
||||
| { type: 'level' }
|
||||
| { type: 'levelUp'; level: number }
|
||||
|
||||
+166
-148
@@ -1,6 +1,5 @@
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query'
|
||||
import { useEffect, useRef, useState, type ChangeEvent, type FormEvent } from 'react'
|
||||
import { Link } from 'react-router'
|
||||
import {
|
||||
addTalkMutation,
|
||||
blockTalkAuthorMutation,
|
||||
@@ -18,8 +17,8 @@ import { kst } from '@nalssigak/shared/lib'
|
||||
import { useRegion } from './regionContext'
|
||||
import { topicName, TOPICS, useMyTalks } from './talkState'
|
||||
import { useSheet } from './sheetContext'
|
||||
import { CameraIcon, HeartIcon } from './svg'
|
||||
import { Avatar, Rail, TAP44 } from './ui'
|
||||
import { CameraIcon, CommentIcon, HeartIcon, SendIcon } from './svg'
|
||||
import { Avatar, TAP44 } from './ui'
|
||||
import { track } from '../lib/analytics'
|
||||
|
||||
const BODY_MAX = 100
|
||||
@@ -32,8 +31,6 @@ const WRITE_ERRORS: Record<string, string> = {
|
||||
INVALID_INPUT: '100자 안으로 써 주세요.',
|
||||
}
|
||||
|
||||
const COMPOSE_ID = 'talk-compose'
|
||||
|
||||
const REASONS = [
|
||||
[TalkReport.ABUSE, '욕설·비하'],
|
||||
[TalkReport.SPAM, '광고·도배'],
|
||||
@@ -49,7 +46,7 @@ function slotWord(iso: string) {
|
||||
|
||||
function useRefreshTalks() {
|
||||
const queryClient = useQueryClient()
|
||||
return () => queryClient.invalidateQueries({ predicate: (q) => ['listTalks', 'listMyTalks', 'talkGroups'].includes((q.queryKey[0] as { _id?: string } | undefined)?._id ?? '') })
|
||||
return () => queryClient.invalidateQueries({ predicate: (q) => ['listTalks', 'listMyTalks'].includes((q.queryKey[0] as { _id?: string } | undefined)?._id ?? '') })
|
||||
}
|
||||
|
||||
function Composer({ onDone }: { onDone?: (t: TalkData) => void }) {
|
||||
@@ -126,7 +123,6 @@ function Composer({ onDone }: { onDone?: (t: TalkData) => void }) {
|
||||
return (
|
||||
<form onSubmit={submit} className="mx-3 rounded-[22px] bg-white p-3 shadow-[inset_0_-5px_0_var(--shade)]">
|
||||
<textarea
|
||||
id={COMPOSE_ID}
|
||||
value={text}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
// 로그인 전엔 읽기 전용이라 눌러도 키보드가 안 올라온다 (키보드가 떴다 내려가며 로그인 창이 버벅이던 것). 누르거나 Enter 면 로그인 창
|
||||
@@ -193,21 +189,17 @@ function Composer({ onDone }: { onDone?: (t: TalkData) => void }) {
|
||||
)
|
||||
}
|
||||
|
||||
/** onGone: 내 글을 지웠을 때. 목록을 다시 받아도 빠지지 않는 곳(방금 쓴 글)에서 직접 뺀다 */
|
||||
function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; compact?: boolean }) {
|
||||
const { loggedIn } = useAuth()
|
||||
const { open } = useSheet()
|
||||
const refresh = useRefreshTalks()
|
||||
type Menu = 'closed' | 'open' | 'confirm' | 'report' | 'done'
|
||||
|
||||
const talkMeta = (t: TalkData) => [t.region_name, slotWord(t.created_at), t.weather, t.topic && t.topic !== TalkTopic.LOCAL ? topicName(t.topic) : null].filter(Boolean).join(' · ')
|
||||
const talkImage = (t: TalkData) => (t.image?.startsWith('/v1/') ? API_BASE_URL + t.image : (t.image ?? undefined))
|
||||
|
||||
/** 좋아요: 화면을 먼저 바꾸고, 실패하면 되돌린다 */
|
||||
function useTalkLike(t: TalkData) {
|
||||
const [liked, setLiked] = useState(t.liked)
|
||||
const [count, setCount] = useState(t.like_count)
|
||||
const [menu, setMenu] = useState<'closed' | 'open' | 'confirm' | 'report' | 'done'>('closed')
|
||||
const like = useMutation(likeTalkMutation())
|
||||
const unlike = useMutation(unlikeTalkMutation())
|
||||
const remove = useMutation(deleteTalkMutation())
|
||||
const report = useMutation(reportTalkMutation())
|
||||
const block = useMutation(blockTalkAuthorMutation())
|
||||
const [failed, setFailed] = useState(false)
|
||||
|
||||
const toggle = () => {
|
||||
if (like.isPending || unlike.isPending) return
|
||||
const next = !liked
|
||||
@@ -231,6 +223,18 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
},
|
||||
)
|
||||
}
|
||||
return { liked, count, toggle }
|
||||
}
|
||||
|
||||
/** 글 메뉴(⋯)를 눌렀을 때 나오는 버튼 줄: 내 글은 지우기, 남의 글은 안 보기·신고 */
|
||||
function TalkMenu({ t, menu, setMenu, onGone, className }: { t: TalkData; menu: Menu; setMenu: (m: Menu) => void; onGone?: () => void; className?: string }) {
|
||||
const { loggedIn } = useAuth()
|
||||
const { open } = useSheet()
|
||||
const refresh = useRefreshTalks()
|
||||
const remove = useMutation(deleteTalkMutation())
|
||||
const report = useMutation(reportTalkMutation())
|
||||
const block = useMutation(blockTalkAuthorMutation())
|
||||
const [failed, setFailed] = useState(false)
|
||||
|
||||
// 메뉴의 동작은 끝나면 목록을 다시 받아 숨긴 글·안 보기로 한 사람의 글이 빠지게 한다
|
||||
const after = (done?: () => void) => ({
|
||||
@@ -243,86 +247,93 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
onError: () => setFailed(true),
|
||||
})
|
||||
const guard = (run: () => void) => (loggedIn ? run() : open({ type: 'login' }))
|
||||
const src = t.image?.startsWith('/v1/') ? API_BASE_URL + t.image : (t.image ?? undefined)
|
||||
|
||||
return (
|
||||
<div className={cx('grid grid-cols-[34px_1fr_auto] gap-2.5 border-b border-(--line) py-2.5 last:border-b-0', compact ? 'h-full w-full items-stretch' : 'items-start')}>
|
||||
<div className={cx('flex flex-wrap gap-1.5 text-[12.5px] font-extrabold', className)} role="group" aria-label="글 메뉴">
|
||||
{menu === 'done' ? (
|
||||
<span className="text-[#1f9d62]">처리했어요</span>
|
||||
) : t.mine && menu === 'confirm' ? (
|
||||
<>
|
||||
<span className="self-center text-(--ink2)">지울까요?</span>
|
||||
<button type="button" onClick={() => remove.mutate({ path: { talk_id: t.talk_id } }, after(() => onGone?.()))} disabled={remove.isPending} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
지우기
|
||||
</button>
|
||||
<button type="button" onClick={() => setMenu('closed')} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
취소
|
||||
</button>
|
||||
</>
|
||||
) : t.mine ? (
|
||||
<button type="button" onClick={() => setMenu('confirm')} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
지우기
|
||||
</button>
|
||||
) : menu === 'report' ? (
|
||||
REASONS.map(([reason, label]) => (
|
||||
<button key={reason} type="button" onClick={() => report.mutate({ path: { talk_id: t.talk_id }, body: { reason } }, after(() => track('report', { content_type: 'talk', reason })))} disabled={report.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
{label}
|
||||
</button>
|
||||
))
|
||||
) : (
|
||||
<>
|
||||
<button type="button" onClick={() => guard(() => block.mutate({ path: { talk_id: t.talk_id } }, after(() => track('block', { content_type: 'talk' }))))} disabled={block.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
이 사람 글 안 보기
|
||||
</button>
|
||||
<button type="button" onClick={() => guard(() => setMenu('report'))} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
신고하기
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{failed && (
|
||||
<span className="text-(--heart)" role="alert">
|
||||
못 했어요. 다시 해 주세요
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function MenuButton({ menu, setMenu, className }: { menu: Menu; setMenu: (m: Menu) => void; className?: string }) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMenu(menu === 'closed' ? 'open' : 'closed')}
|
||||
aria-expanded={menu !== 'closed'}
|
||||
aria-label="글 메뉴"
|
||||
className={cx('relative cursor-pointer text-[15px] leading-none font-extrabold tracking-[1px] text-(--ink3)', TAP44, className)}
|
||||
>
|
||||
⋯
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
const MINE_BADGE = 'rounded-full bg-[#ffe8dc] px-1.5 py-px text-[11px] font-extrabold text-[#c2471b]'
|
||||
|
||||
/** onGone: 내 글을 지웠을 때. 목록을 다시 받아도 빠지지 않는 곳(방금 쓴 글)에서 직접 뺀다 */
|
||||
function TalkRow({ t, onGone }: { t: TalkData; onGone?: () => void }) {
|
||||
const { liked, count, toggle } = useTalkLike(t)
|
||||
const [menu, setMenu] = useState<Menu>('closed')
|
||||
const src = talkImage(t)
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-[34px_1fr_auto] items-start gap-2.5 border-b border-(--line) py-2.5 last:border-b-0">
|
||||
<span className="self-start">
|
||||
<Avatar character={t.character} color={t.color} mood={t.mood} />
|
||||
</span>
|
||||
{/* 묶음 카드는 옆 카드 높이에 맞춰 늘어나니, 시간·좋아요 줄을 맨 아래에 붙여 빈 곳이 아래에 몰리지 않게 */}
|
||||
<div className={cx('min-w-0', compact && 'flex flex-col')}>
|
||||
<small className={cx('block text-xs font-bold text-(--ink3)', compact && 'truncate')}>
|
||||
<div className="min-w-0">
|
||||
<small className="block text-xs font-bold text-(--ink3)">
|
||||
<b className="mr-1 font-extrabold text-(--ink)">{t.nickname}</b>
|
||||
{t.mine && <span className="mr-1 rounded-full bg-[#ffe8dc] px-1.5 py-px text-[11px] font-extrabold text-[#c2471b]">내 글</span>}
|
||||
{[t.region_name, slotWord(t.created_at), t.weather, t.topic && t.topic !== TalkTopic.LOCAL ? topicName(t.topic) : null].filter(Boolean).join(' · ')}
|
||||
{t.mine && <span className={cx('mr-1', MINE_BADGE)}>내 글</span>}
|
||||
{talkMeta(t)}
|
||||
</small>
|
||||
{/* 묶음 안 작은 카드는 글이 잘리니, 누르면 창에서 글 전체·큰 사진을 본다 */}
|
||||
{compact ? (
|
||||
<button type="button" onClick={() => open({ type: 'talk', talk: { ...t, liked, like_count: count } })} aria-label={`${t.nickname}의 글 전체 보기`} className="block w-full cursor-pointer text-left">
|
||||
{t.image && <img src={src} alt="" loading="lazy" className="float-right mt-1 ml-2 size-12 rounded-xl bg-[#eef4fc] object-cover" />}
|
||||
<p className="m-0 mt-0.5 line-clamp-2 min-h-[2lh] text-[14.5px] break-words whitespace-pre-wrap">{t.body}</p>
|
||||
</button>
|
||||
) : (
|
||||
<p className="m-0 mt-0.5 text-[14.5px] break-words whitespace-pre-wrap">{t.body}</p>
|
||||
)}
|
||||
{t.image && !compact && <img src={src} alt="" loading="lazy" className="mt-2 aspect-[4/5] w-full rounded-2xl bg-[#eef4fc] object-cover" />}
|
||||
<small className={cx('block text-xs font-bold text-(--ink3)', compact ? 'mt-auto pt-1.5' : 'mt-0.5')}>
|
||||
<p className="m-0 mt-0.5 text-[14.5px] break-words whitespace-pre-wrap">{t.body}</p>
|
||||
{src && <img src={src} alt="" loading="lazy" className="mt-2 aspect-[4/5] w-full rounded-2xl bg-[#eef4fc] object-cover" />}
|
||||
<small className="mt-0.5 block text-xs font-bold text-(--ink3)">
|
||||
{t.ago} · 좋아요 {count}개
|
||||
</small>
|
||||
{menu !== 'closed' && (
|
||||
<div className="mt-1.5 flex flex-wrap gap-1.5 text-[12.5px] font-extrabold" role="group" aria-label="글 메뉴">
|
||||
{menu === 'done' ? (
|
||||
<span className="text-[#1f9d62]">처리했어요</span>
|
||||
) : t.mine && menu === 'confirm' ? (
|
||||
<>
|
||||
<span className="self-center text-(--ink2)">지울까요?</span>
|
||||
<button type="button" onClick={() => remove.mutate({ path: { talk_id: t.talk_id } }, after(() => onGone?.()))} disabled={remove.isPending} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
지우기
|
||||
</button>
|
||||
<button type="button" onClick={() => setMenu('closed')} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
취소
|
||||
</button>
|
||||
</>
|
||||
) : t.mine ? (
|
||||
<button type="button" onClick={() => setMenu('confirm')} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
지우기
|
||||
</button>
|
||||
) : menu === 'report' ? (
|
||||
REASONS.map(([reason, label]) => (
|
||||
<button key={reason} type="button" onClick={() => report.mutate({ path: { talk_id: t.talk_id }, body: { reason } }, after(() => track('report', { content_type: 'talk', reason })))} disabled={report.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
{label}
|
||||
</button>
|
||||
))
|
||||
) : (
|
||||
<>
|
||||
<button type="button" onClick={() => guard(() => block.mutate({ path: { talk_id: t.talk_id } }, after(() => track('block', { content_type: 'talk' }))))} disabled={block.isPending} className="cursor-pointer rounded-full bg-[#eef4fc] px-3 py-1">
|
||||
이 사람 글 안 보기
|
||||
</button>
|
||||
<button type="button" onClick={() => guard(() => setMenu('report'))} className="cursor-pointer rounded-full bg-[#fdecec] px-3 py-1 text-(--heart)">
|
||||
신고하기
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{failed && (
|
||||
<span className="text-(--heart)" role="alert">
|
||||
못 했어요. 다시 해 주세요
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{menu !== 'closed' && <TalkMenu t={t} menu={menu} setMenu={setMenu} onGone={onGone} className="mt-1.5" />}
|
||||
</div>
|
||||
{/* 글 메뉴(⋯)는 하트 옆 오른쪽 위에: 아래 줄 끝에 두면 말줄임표처럼 읽힌다 */}
|
||||
<span className="flex items-start gap-4 self-start">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setMenu(menu === 'closed' ? 'open' : 'closed')}
|
||||
aria-expanded={menu !== 'closed'}
|
||||
aria-label="글 메뉴"
|
||||
className={cx('relative cursor-pointer pt-0.5 text-[15px] leading-none font-extrabold tracking-[1px] text-(--ink3)', TAP44)}
|
||||
>
|
||||
⋯
|
||||
</button>
|
||||
<MenuButton menu={menu} setMenu={setMenu} className="pt-0.5" />
|
||||
<button type="button" onClick={toggle} aria-pressed={liked} aria-label="좋아요" className={cx('relative cursor-pointer pt-1', TAP44)}>
|
||||
<HeartIcon className={cx('size-4 stroke-2', liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-(--ink3)')} />
|
||||
</button>
|
||||
@@ -331,8 +342,76 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
|
||||
)
|
||||
}
|
||||
|
||||
// 사진 없는 글을 크게 띄울 때 주제별 바탕
|
||||
const TOPIC_BG: Partial<Record<TalkTopic, string>> = { [TalkTopic.SKY]: 'peach', [TalkTopic.RAIN]: 'sky', [TalkTopic.FOLIAGE]: 'butter', [TalkTopic.OUTFIT]: 'lilac' }
|
||||
|
||||
/** 오늘 피드에 끼우는 사람 글: 운영 포스트와 같은 틀(머리줄·4:5 본문·버튼줄·댓글). 사진이 없으면 글을 4:5 칸에 크게. 두 번 누르면 좋아요 */
|
||||
export function TalkPost({ t }: { t: TalkData }) {
|
||||
const { open } = useSheet()
|
||||
const { liked, count, toggle } = useTalkLike(t)
|
||||
const [menu, setMenu] = useState<Menu>('closed')
|
||||
const bodyRef = useRef<HTMLDivElement>(null)
|
||||
const lastTap = useRef(0)
|
||||
const src = talkImage(t)
|
||||
const share = () => {
|
||||
if (bodyRef.current) open({ type: 'share', share: { title: `${t.nickname}의 글`, slides: [bodyRef.current] } })
|
||||
}
|
||||
const comments = () => open({ type: 'comments', talkId: t.talk_id })
|
||||
const onTap = () => {
|
||||
const now = Date.now()
|
||||
if (now - lastTap.current < 320 && !liked) toggle()
|
||||
lastTap.current = now
|
||||
}
|
||||
|
||||
return (
|
||||
<article className="mt-3.5 border-y border-(--line) bg-white" aria-label={`${t.nickname}의 글`}>
|
||||
<div className="flex items-center gap-2.5 px-3 py-2.5">
|
||||
<Avatar character={t.character} color={t.color} mood={t.mood} />
|
||||
<span className="min-w-0">
|
||||
<b className="block text-sm leading-tight font-extrabold">
|
||||
{t.nickname}
|
||||
{t.mine && <span className={cx('ml-1 align-middle', MINE_BADGE)}>내 글</span>}
|
||||
</b>
|
||||
<small className="block truncate text-xs font-semibold text-(--ink2)">{talkMeta(t)}</small>
|
||||
</span>
|
||||
<MenuButton menu={menu} setMenu={setMenu} className="ml-auto" />
|
||||
</div>
|
||||
{menu !== 'closed' && <TalkMenu t={t} menu={menu} setMenu={setMenu} className="px-3 pb-2.5" />}
|
||||
<div ref={bodyRef} onClick={onTap} className={cx('b-day aspect-[4/5] overflow-hidden', !src && `b-bg-${(t.topic && TOPIC_BG[t.topic]) || 'mint'} grid place-items-center px-7`)}>
|
||||
{src ? (
|
||||
<img src={src} alt="" loading="lazy" className="size-full bg-[#eef4fc] object-cover" />
|
||||
) : (
|
||||
<p className="m-0 w-full text-center font-jua text-[26px] leading-snug whitespace-pre-wrap [overflow-wrap:anywhere]">{t.body}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-3.5 px-3 pt-2.5 pb-1 [&_svg]:size-[26px] [&_svg]:stroke-[1.9]">
|
||||
<button type="button" onClick={toggle} aria-pressed={liked} aria-label="좋아요" className={cx('relative grid size-7 cursor-pointer place-items-center', TAP44)}>
|
||||
<HeartIcon className={liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-(--ink)'} />
|
||||
</button>
|
||||
<button type="button" onClick={comments} aria-label="댓글 보기" className={cx('relative grid size-7 cursor-pointer place-items-center', TAP44)}>
|
||||
<CommentIcon className="fill-none stroke-(--ink) [stroke-linejoin:round]" />
|
||||
</button>
|
||||
<button type="button" onClick={share} aria-label="보내기" className={cx('relative grid size-7 cursor-pointer place-items-center', TAP44)}>
|
||||
<SendIcon className="fill-none stroke-(--ink) [stroke-linecap:round] [stroke-linejoin:round]" />
|
||||
</button>
|
||||
</div>
|
||||
<p className="px-3 py-0.5 text-sm font-extrabold">좋아요 {count.toLocaleString()}개</p>
|
||||
{src && (
|
||||
<p className="px-3 py-0.5 text-sm break-words whitespace-pre-wrap">
|
||||
<b className="mr-[5px] font-extrabold">{t.nickname}</b>
|
||||
{t.body}
|
||||
</p>
|
||||
)}
|
||||
<button type="button" onClick={comments} className="block cursor-pointer px-3 pt-[3px] text-sm font-semibold text-(--ink3)">
|
||||
{t.comment_count ? `댓글 ${t.comment_count}개 모두 보기` : '첫 댓글 남기기'}
|
||||
</button>
|
||||
<p className="px-3 pt-1 pb-3 text-[11.5px] font-semibold text-(--ink3)">{t.ago}</p>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
/** 이야기 탭: 쓰기 칸과 전국 최신 글 (아래로 더 받기) */
|
||||
/** 피드 위 쓰는 칸. 늘 펼쳐 두고, 오늘 쓴 내 글은 바로 아래 '오늘 내 글' 묶음에 보인다 */
|
||||
/** 피드 위 쓰는 칸. 늘 펼쳐 두고, 쓴 글은 아래 피드에 다른 사람 글과 같이 섞여 보인다 */
|
||||
export function FeedComposer() {
|
||||
return (
|
||||
<div className="mt-3.5">
|
||||
@@ -341,15 +420,6 @@ export function FeedComposer() {
|
||||
)
|
||||
}
|
||||
|
||||
/** 묶음에서 누른 글 하나를 창으로: 글 전체·큰 사진·좋아요·글 메뉴 */
|
||||
export function TalkSheet({ talk }: { talk: TalkData }) {
|
||||
return (
|
||||
<div className="flex-1 overflow-auto overscroll-contain px-4 pb-[18px]">
|
||||
<TalkRow t={talk} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** 피드에 끼우는 글 한 장 */
|
||||
export function TalkCard({ t, onGone }: { t: TalkData; onGone?: () => void }) {
|
||||
return (
|
||||
@@ -359,58 +429,6 @@ export function TalkCard({ t, onGone }: { t: TalkData; onGone?: () => void }) {
|
||||
)
|
||||
}
|
||||
|
||||
/** 오늘 피드의 사람 글 묶음: 옆으로 넘기는 카드, 끝에 그 주제 전체 보기 */
|
||||
/** href: 오른쪽 위 '전체 보기'가 여는 곳 (없으면 이야기 탭의 그 주제) */
|
||||
export function TalkGroup({ title, topic, talks, href }: { title: string; topic?: number; talks: TalkData[]; href?: string }) {
|
||||
return (
|
||||
<section aria-label={title} className="mt-3.5">
|
||||
<div className="flex items-end justify-between px-4">
|
||||
<h2 className="m-0 font-jua text-[19px] font-normal">{title}</h2>
|
||||
<Link to={href ?? (topic ? `/talk?topic=${topic}` : '/talk')} className="text-[13px] font-bold text-(--ink2)">
|
||||
전체 보기
|
||||
</Link>
|
||||
</div>
|
||||
<Rail label={title}>
|
||||
{talks.map((t) => (
|
||||
<article key={`${t.talk_id}:${t.liked}:${t.like_count}`} className="flex w-[78%] max-w-[320px] rounded-[20px] bg-white px-3 shadow-[inset_0_-4px_0_var(--shade)]" aria-label={`${t.nickname}의 글`}>
|
||||
<TalkRow t={t} compact />
|
||||
</article>
|
||||
))}
|
||||
</Rail>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
/** '동네 사람들' 글이 적을 때 묶음 대신: 위 쓰기 칸으로 데려간다 */
|
||||
export function FirstTalkCard() {
|
||||
const { region } = useRegion()
|
||||
const place = region.name.split(' ').at(-1)
|
||||
const { loggedIn } = useAuth()
|
||||
const { open } = useSheet()
|
||||
const go = () => {
|
||||
if (!loggedIn) return open({ type: 'login' })
|
||||
const el = document.getElementById(COMPOSE_ID)
|
||||
el?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
el?.focus({ preventScroll: true })
|
||||
}
|
||||
return (
|
||||
<button type="button" onClick={go} className="mx-3 mt-3.5 flex w-[calc(100%-1.5rem)] cursor-pointer items-center gap-3 rounded-[22px] bg-white p-3.5 text-left shadow-[inset_0_-5px_0_var(--shade)]">
|
||||
<span className="font-jua text-[16.5px] leading-snug">
|
||||
지금 {place} 하늘 어때요?
|
||||
<small className="block font-sans text-[12.5px] font-semibold text-(--ink2)">첫 이야기를 남겨 주세요</small>
|
||||
</span>
|
||||
<span className="ml-auto shrink-0 rounded-full bg-(--orange) px-3.5 py-1.5 text-[13px] font-extrabold text-white">쓰기</span>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
/** '동네 사람들' 자리: 글이 하나라도 있으면 묶음, 없으면 첫 글 쓰기 */
|
||||
export function NearTalks({ talks, loaded }: { talks: TalkData[]; loaded: boolean }) {
|
||||
if (!loaded) return null
|
||||
if (talks.length) return <TalkGroup title="동네 사람들" talks={talks} />
|
||||
return <FirstTalkCard />
|
||||
}
|
||||
|
||||
/** 내 정보 창의 내가 쓴 글 */
|
||||
export function MyTalks() {
|
||||
const { talks, loaded, more, loadMore } = useMyTalks()
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
|
||||
import { useState } from 'react'
|
||||
import { listMyTalksInfiniteOptions, listMyTalksOptions, listTalksInfiniteOptions, talkGroupsOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
|
||||
import { TalkTopic, type TalkData } from '@nalssigak/shared/api/client/types.gen'
|
||||
import { kst } from '@nalssigak/shared/lib'
|
||||
import { useInfiniteQuery } from '@tanstack/react-query'
|
||||
import { listMyTalksInfiniteOptions, listTalksInfiniteOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen'
|
||||
import { TalkTopic } from '@nalssigak/shared/api/client/types.gen'
|
||||
import { useRegion } from './regionContext'
|
||||
|
||||
// 글 주제와 피드 묶음 이름
|
||||
// 글 주제와 이름
|
||||
export const TOPICS = [
|
||||
[TalkTopic.LOCAL, '동네 이야기'],
|
||||
[TalkTopic.SKY, '하늘·노을'],
|
||||
@@ -15,14 +13,6 @@ export const TOPICS = [
|
||||
] as const
|
||||
export const topicName = (t?: number) => TOPICS.find(([k]) => k === t)?.[1] ?? '동네 이야기'
|
||||
|
||||
/** 오늘 피드 묶음: 0 은 '동네 사람들', 나머지는 주제별(3장 이상일 때만 옴) */
|
||||
export function useTalkGroups() {
|
||||
const { region } = useRegion()
|
||||
const q = useQuery(talkGroupsOptions({ query: { region: region.code } }))
|
||||
const groups = new Map<number, TalkData[]>((q.data?.groups ?? []).map((g) => [g.topic, g.talks ?? []]))
|
||||
return { groups, loaded: q.isSuccess }
|
||||
}
|
||||
|
||||
/** 주제별 글 페이지 목록 (topic 없으면 전체) */
|
||||
export function useTopicTalks(topic?: TalkTopic) {
|
||||
const { region } = useRegion()
|
||||
@@ -39,17 +29,6 @@ export function useTopicTalks(topic?: TalkTopic) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 오늘(한국 날짜) 쓴 내 글, 최신순. 로그인했을 때만 받는다 */
|
||||
export function useTodayMyTalks(loggedIn: boolean) {
|
||||
const q = useQuery({ ...listMyTalksOptions(), enabled: loggedIn })
|
||||
// 오늘 날짜는 화면을 연 때 기준으로 한 번만
|
||||
const [now] = useState(() => kst(new Date()))
|
||||
return (q.data?.talks ?? []).filter((t) => {
|
||||
const d = kst(t.created_at)
|
||||
return d.y === now.y && d.mo === now.mo && d.d === now.d
|
||||
})
|
||||
}
|
||||
|
||||
/** 내가 쓴 글 (최신순) */
|
||||
export function useMyTalks(enabled = true) {
|
||||
const list = useInfiniteQuery({
|
||||
|
||||
@@ -19,10 +19,12 @@ type Events = {
|
||||
sheet_open: { sheet: SheetType }
|
||||
like: { content_type: 'post' | 'comment' | 'talk' | PinnedKey; item_id: number }
|
||||
comment: { post_id: number }
|
||||
talk_comment: { talk_id: number }
|
||||
report: { content_type: 'comment' | 'talk'; reason: number }
|
||||
block: { content_type: 'comment' | 'talk' }
|
||||
terms_agree: Record<string, never>
|
||||
talk_post: { topic: number; with_image: boolean }
|
||||
feed_item_view: { item_type: 'talk' | 'event'; position: number }
|
||||
hero_day_switch: { day: 'today' | 'tomorrow' }
|
||||
shorts_open: { video_id: string }
|
||||
shorts_view: { video_id: string; index: number }
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { type DefaultError, type InfiniteData, infiniteQueryOptions, queryOptions, type UseMutationOptions } from '@tanstack/react-query';
|
||||
|
||||
import { client } from '../client.gen';
|
||||
import { addComment, addMyGak, addTalk, agreeTerms, attend, authConfig, blockAuthor, blockTalkAuthor, createCard, createReel, deleteBirth, deleteComment, deleteMyGak, deleteTalk, drawFortune, gameRound, gameStart, getArticle, getBirth, getCardImage, getFeed, getFortuneToday, getImage, getIndex, getPost, getReelCover, getReelVideo, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, importFortune, likeComment, likePost, likeTalk, listArticles, listBlocked, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listReels, listRegions, listSaved, listShorts, listTalks, listUsers, login, logout, match, me, myLevel, nearestRegion, type Options, publishCard, publishInstagram, publishInstagram2, putBirth, reading, refresh, rejectCard, reportComment, reportTalk, saveDayLog, savePost, scoreMyGak, searchFortunePlaces, shared, signup, talkGroups, toss, tossUnlink, unblock, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage, withdraw } from '../sdk.gen';
|
||||
import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkData, AddTalkError, AddTalkResponse, AgreeTermsData, AgreeTermsError, AgreeTermsResponse, AttendData, AttendError, AttendResponse, AuthConfigData, AuthConfigResponse, BlockAuthorData, BlockAuthorError, BlockAuthorResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, CreateCardData, CreateCardError, CreateCardResponse, CreateReelData, CreateReelError, CreateReelResponse, DeleteBirthData, DeleteBirthError, DeleteBirthResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, DrawFortuneData, DrawFortuneError, DrawFortuneResponse, GameRoundData, GameRoundError, GameRoundResponse, GameStartData, GameStartError, GameStartResponse, GetArticleData, GetArticleError, GetArticleResponse, GetBirthData, GetBirthError, GetBirthResponse, GetCardImageData, GetCardImageError, GetFeedData, GetFeedError, GetFeedResponse, GetFortuneTodayData, GetFortuneTodayError, GetFortuneTodayResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetReelCoverData, GetReelCoverError, GetReelVideoData, GetReelVideoError, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTalkImageData, GetTalkImageError, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetTomorrowGuPageData, GetTomorrowGuPageError, GetTomorrowGuPageResponse, GetTomorrowPageData, GetTomorrowPageError, GetTomorrowPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, GoogleLoginData, GoogleLoginError, GoogleLoginResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, ImportFortuneData, ImportFortuneError, ImportFortuneResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListBlockedData, ListBlockedError, ListBlockedResponse, ListCardsData, ListCardsError, ListCardsResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListMyTalksData, ListMyTalksError, ListMyTalksResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListPresetsData, ListPresetsResponse, ListReelsData, ListReelsError, ListReelsResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListShortsData, ListShortsResponse, ListTalksData, ListTalksError, ListTalksResponse, ListUsersData, ListUsersError, ListUsersResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MatchData, MatchError, MatchResponse, MeData, MeError, MeResponse, MyLevelData, MyLevelError, MyLevelResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, PublishCardData, PublishCardError, PublishCardResponse, PublishInstagram2Data, PublishInstagram2Error, PublishInstagram2Response, PublishInstagramData, PublishInstagramError, PublishInstagramResponse, PutBirthData, PutBirthError, PutBirthResponse, ReadingData, ReadingError, ReadingResponse, RefreshData, RefreshError, RefreshResponse, RejectCardData, RejectCardError, RejectCardResponse, ReportCommentData, ReportCommentError, ReportCommentResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SaveDayLogData, SaveDayLogError, SaveDayLogResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SearchFortunePlacesData, SearchFortunePlacesError, SearchFortunePlacesResponse, SharedData, SharedError, SharedResponse, SignupData, SignupError, SignupResponse, TalkGroupsData, TalkGroupsError, TalkGroupsResponse, TossData, TossError, TossResponse, TossUnlinkData, TossUnlinkError, TossUnlinkResponse, UnblockData, UnblockError, UnblockResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse, UploadTalkImageData, UploadTalkImageError, UploadTalkImageResponse, WithdrawData, WithdrawError, WithdrawResponse } from '../types.gen';
|
||||
import { addComment, addMyGak, addTalk, addTalkComment, agreeTerms, attend, authConfig, blockAuthor, blockTalkAuthor, createCard, createReel, deleteBirth, deleteComment, deleteMyGak, deleteTalk, drawFortune, gameRound, gameStart, getArticle, getBirth, getCardImage, getFeed, getFortuneToday, getImage, getIndex, getPost, getReelCover, getReelVideo, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, importFortune, likeComment, likePost, likeTalk, listArticles, listBlocked, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listReels, listRegions, listSaved, listShorts, listTalkComments, listTalks, listUsers, login, logout, match, me, myLevel, nearestRegion, type Options, publishCard, publishInstagram, publishInstagram2, putBirth, reading, refresh, rejectCard, reportComment, reportTalk, saveDayLog, savePost, scoreMyGak, searchFortunePlaces, shared, signup, talkGroups, toss, tossUnlink, unblock, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage, withdraw } from '../sdk.gen';
|
||||
import type { AddCommentData, AddCommentError, AddCommentResponse, AddMyGakData, AddMyGakError, AddMyGakResponse, AddTalkCommentData, AddTalkCommentError, AddTalkCommentResponse, AddTalkData, AddTalkError, AddTalkResponse, AgreeTermsData, AgreeTermsError, AgreeTermsResponse, AttendData, AttendError, AttendResponse, AuthConfigData, AuthConfigResponse, BlockAuthorData, BlockAuthorError, BlockAuthorResponse, BlockTalkAuthorData, BlockTalkAuthorError, BlockTalkAuthorResponse, CreateCardData, CreateCardError, CreateCardResponse, CreateReelData, CreateReelError, CreateReelResponse, DeleteBirthData, DeleteBirthError, DeleteBirthResponse, DeleteCommentData, DeleteCommentError, DeleteCommentResponse, DeleteMyGakData, DeleteMyGakError, DeleteMyGakResponse, DeleteTalkData, DeleteTalkError, DeleteTalkResponse, DrawFortuneData, DrawFortuneError, DrawFortuneResponse, GameRoundData, GameRoundError, GameRoundResponse, GameStartData, GameStartError, GameStartResponse, GetArticleData, GetArticleError, GetArticleResponse, GetBirthData, GetBirthError, GetBirthResponse, GetCardImageData, GetCardImageError, GetFeedData, GetFeedError, GetFeedResponse, GetFortuneTodayData, GetFortuneTodayError, GetFortuneTodayResponse, GetImageData, GetImageError, GetIndexData, GetIndexError, GetIndexResponse, GetPostData, GetPostError, GetPostResponse, GetReelCoverData, GetReelCoverError, GetReelVideoData, GetReelVideoError, GetSeasonWeekData, GetSeasonWeekResponse, GetSkyData, GetSkyError, GetSkyRankingData, GetSkyRankingResponse, GetSkyResponse, GetTalkImageData, GetTalkImageError, GetTodayGuPageData, GetTodayGuPageError, GetTodayGuPageResponse, GetTodayPageData, GetTodayPageError, GetTodayPageResponse, GetTomorrowGuPageData, GetTomorrowGuPageError, GetTomorrowGuPageResponse, GetTomorrowPageData, GetTomorrowPageError, GetTomorrowPageResponse, GetWatchSummaryData, GetWatchSummaryError, GetWatchSummaryResponse, GetWeatherNowData, GetWeatherNowError, GetWeatherNowResponse, GetWeatherTodayData, GetWeatherTodayError, GetWeatherTodayResponse, GetWeekData, GetWeekError, GetWeekRankingData, GetWeekRankingResponse, GetWeekResponse, GoogleLoginData, GoogleLoginError, GoogleLoginResponse, HealthzHealthzGetData, HealthzHealthzGetResponse, ImportFortuneData, ImportFortuneError, ImportFortuneResponse, LikeCommentData, LikeCommentError, LikeCommentResponse, LikePostData, LikePostError, LikePostResponse, LikeTalkData, LikeTalkError, LikeTalkResponse, ListArticlesData, ListArticlesError, ListArticlesResponse, ListBlockedData, ListBlockedError, ListBlockedResponse, ListCardsData, ListCardsError, ListCardsResponse, ListCommentsData, ListCommentsError, ListCommentsResponse, ListEventsData, ListEventsError, ListEventsResponse, ListIndicesData, ListIndicesError, ListIndicesResponse, ListMyGakData, ListMyGakError, ListMyGakResponse, ListMyTalksData, ListMyTalksError, ListMyTalksResponse, ListPlacesData, ListPlacesError, ListPlacesResponse, ListPresetsData, ListPresetsResponse, ListReelsData, ListReelsError, ListReelsResponse, ListRegionsData, ListRegionsError, ListRegionsResponse, ListSavedData, ListSavedError, ListSavedResponse, ListShortsData, ListShortsResponse, ListTalkCommentsData, ListTalkCommentsError, ListTalkCommentsResponse, ListTalksData, ListTalksError, ListTalksResponse, ListUsersData, ListUsersError, ListUsersResponse, LoginData, LoginError, LoginResponse, LogoutData, LogoutError, LogoutResponse, MatchData, MatchError, MatchResponse, MeData, MeError, MeResponse, MyLevelData, MyLevelError, MyLevelResponse, NearestRegionData, NearestRegionError, NearestRegionResponse, PublishCardData, PublishCardError, PublishCardResponse, PublishInstagram2Data, PublishInstagram2Error, PublishInstagram2Response, PublishInstagramData, PublishInstagramError, PublishInstagramResponse, PutBirthData, PutBirthError, PutBirthResponse, ReadingData, ReadingError, ReadingResponse, RefreshData, RefreshError, RefreshResponse, RejectCardData, RejectCardError, RejectCardResponse, ReportCommentData, ReportCommentError, ReportCommentResponse, ReportTalkData, ReportTalkError, ReportTalkResponse, SaveDayLogData, SaveDayLogError, SaveDayLogResponse, SavePostData, SavePostError, SavePostResponse, ScoreMyGakData, ScoreMyGakError, ScoreMyGakResponse, SearchFortunePlacesData, SearchFortunePlacesError, SearchFortunePlacesResponse, SharedData, SharedError, SharedResponse, SignupData, SignupError, SignupResponse, TalkGroupsData, TalkGroupsError, TalkGroupsResponse, TossData, TossError, TossResponse, TossUnlinkData, TossUnlinkError, TossUnlinkResponse, UnblockData, UnblockError, UnblockResponse, UnlikeCommentData, UnlikeCommentError, UnlikeCommentResponse, UnlikePostData, UnlikePostError, UnlikePostResponse, UnlikeTalkData, UnlikeTalkError, UnlikeTalkResponse, UnsavePostData, UnsavePostError, UnsavePostResponse, UpdateMeData, UpdateMeError, UpdateMeResponse, UploadTalkImageData, UploadTalkImageError, UploadTalkImageResponse, WithdrawData, WithdrawError, WithdrawResponse } from '../types.gen';
|
||||
|
||||
export type QueryKey<TOptions extends Options> = [
|
||||
Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
|
||||
@@ -761,6 +761,71 @@ export const addCommentMutation = (options?: Partial<Options<AddCommentData>>):
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const listTalkCommentsQueryKey = (options: Options<ListTalkCommentsData>) => createQueryKey('listTalkComments', options);
|
||||
|
||||
/**
|
||||
* 사람 글 댓글 목록 (로그인 없이 보기)
|
||||
*/
|
||||
export const listTalkCommentsOptions = (options: Options<ListTalkCommentsData>) => queryOptions<ListTalkCommentsResponse, ListTalkCommentsError, ListTalkCommentsResponse, ReturnType<typeof listTalkCommentsQueryKey>>({
|
||||
queryFn: async ({ queryKey, signal }) => {
|
||||
const { data } = await listTalkComments({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listTalkCommentsQueryKey(options)
|
||||
});
|
||||
|
||||
export const listTalkCommentsInfiniteQueryKey = (options: Options<ListTalkCommentsData>): QueryKey<Options<ListTalkCommentsData>> => createQueryKey('listTalkComments', options, true);
|
||||
|
||||
/**
|
||||
* 사람 글 댓글 목록 (로그인 없이 보기)
|
||||
*/
|
||||
export const listTalkCommentsInfiniteOptions = (options: Options<ListTalkCommentsData>) => {
|
||||
const opts = infiniteQueryOptions<ListTalkCommentsResponse, ListTalkCommentsError, InfiniteData<ListTalkCommentsResponse>, QueryKey<Options<ListTalkCommentsData>>, number | null | Pick<QueryKey<Options<ListTalkCommentsData>>[0], 'body' | 'headers' | 'path' | 'query'>>(
|
||||
// @ts-ignore
|
||||
{
|
||||
queryFn: async ({ pageParam, queryKey, signal }) => {
|
||||
// @ts-ignore
|
||||
const page: Pick<QueryKey<Options<ListTalkCommentsData>>[0], 'body' | 'headers' | 'path' | 'query'> = typeof pageParam === 'object' ? pageParam : {
|
||||
query: {
|
||||
cursor: pageParam
|
||||
}
|
||||
};
|
||||
const params = createInfiniteParams(queryKey, page);
|
||||
const { data } = await listTalkComments({
|
||||
...options,
|
||||
...params,
|
||||
signal,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: listTalkCommentsInfiniteQueryKey(options)
|
||||
});
|
||||
return opts as Omit<typeof opts, 'initialData'>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 사람 글 댓글 쓰기 (로그인한 사람만, 60자, 링크·전화번호 불가, 이용약관 동의 전이면 TERMS_REQUIRED). 지우기·좋아요·신고·차단은 /comment/{comment_id} 그대로
|
||||
*/
|
||||
export const addTalkCommentMutation = (options?: Partial<Options<AddTalkCommentData>>): UseMutationOptions<AddTalkCommentResponse, AddTalkCommentError, Options<AddTalkCommentData>> => {
|
||||
const mutationOptions: UseMutationOptions<AddTalkCommentResponse, AddTalkCommentError, Options<AddTalkCommentData>> = {
|
||||
mutationFn: async (fnOptions) => {
|
||||
const { data } = await addTalkComment({
|
||||
...options,
|
||||
...fnOptions,
|
||||
throwOnError: true
|
||||
});
|
||||
return data;
|
||||
}
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* 내 댓글 지우기 (로그인 없이 쓴 댓글은 같은 IP 에서)
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export { addComment, addMyGak, addTalk, agreeTerms, attend, authConfig, blockAuthor, blockTalkAuthor, createCard, createReel, deleteBirth, deleteComment, deleteMyGak, deleteTalk, drawFortune, gameRound, gameStart, getArticle, getBirth, getCardImage, getFeed, getFortuneToday, getImage, getIndex, getPost, getReelCover, getReelVideo, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, importFortune, likeComment, likePost, likeTalk, listArticles, listBlocked, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listReels, listRegions, listSaved, listShorts, listTalks, listUsers, login, logout, match, me, myLevel, nearestRegion, type Options, publishCard, publishInstagram, publishInstagram2, putBirth, reading, refresh, rejectCard, reportComment, reportTalk, saveDayLog, savePost, scoreMyGak, searchFortunePlaces, shared, signup, talkGroups, toss, tossUnlink, unblock, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage, withdraw } from './sdk.gen';
|
||||
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AdminUser, type AgreeTermsData, type AgreeTermsError, type AgreeTermsErrors, type AgreeTermsResponse, type AgreeTermsResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, type AttendData, type AttendError, type AttendErrors, type AttendResponse, type AttendResponses, type AuthConfigData, type AuthConfigResponse, type AuthConfigResponses, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockAuthorData, type BlockAuthorError, type BlockAuthorErrors, type BlockAuthorResponse, type BlockAuthorResponses, type BlockedUser, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type BodyUploadTalkImageV1TalkImagePost, type CardItem, CardStatus, type ClientOptions, type CommentData, type CommuteData, Confidence, type CreateCardData, type CreateCardError, type CreateCardErrors, type CreateCardResponse, type CreateCardResponses, type CreateReelData, type CreateReelError, type CreateReelErrors, type CreateReelResponse, type CreateReelResponses, type Cut, type DayData, type DayLogData, type DeleteBirthData, type DeleteBirthError, type DeleteBirthErrors, type DeleteBirthResponse, type DeleteBirthResponses, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type DrawFortuneData, type DrawFortuneError, type DrawFortuneErrors, type DrawFortuneResponse, type DrawFortuneResponses, type ErrorInfo, type EventData, type Factor, type FortuneCard, type FortuneLuck, type FortunePlace, type GakSlide, type GameRoundData, type GameRoundError, type GameRoundErrors, type GameRoundResponse, type GameRoundResponses, type GameStartData, type GameStartError, type GameStartErrors, type GameStartResponse, type GameStartResponses, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetBirthData, type GetBirthError, type GetBirthErrors, type GetBirthResponse, type GetBirthResponses, type GetCardImageData, type GetCardImageError, type GetCardImageErrors, type GetCardImageResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetFortuneTodayData, type GetFortuneTodayError, type GetFortuneTodayErrors, type GetFortuneTodayResponse, type GetFortuneTodayResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetReelCoverData, type GetReelCoverError, type GetReelCoverErrors, type GetReelCoverResponses, type GetReelVideoData, type GetReelVideoError, type GetReelVideoErrors, type GetReelVideoResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTalkImageData, type GetTalkImageError, type GetTalkImageErrors, type GetTalkImageResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetTomorrowGuPageData, type GetTomorrowGuPageError, type GetTomorrowGuPageErrors, type GetTomorrowGuPageResponse, type GetTomorrowGuPageResponses, type GetTomorrowPageData, type GetTomorrowPageError, type GetTomorrowPageErrors, type GetTomorrowPageResponse, type GetTomorrowPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeekErrors, type GetWeekRankingData, type GetWeekRankingResponse, type GetWeekRankingResponses, type GetWeekResponse, type GetWeekResponsesLine truncated
|
||||
export { addComment, addMyGak, addTalk, addTalkComment, agreeTerms, attend, authConfig, blockAuthor, blockTalkAuthor, createCard, createReel, deleteBirth, deleteComment, deleteMyGak, deleteTalk, drawFortune, gameRound, gameStart, getArticle, getBirth, getCardImage, getFeed, getFortuneToday, getImage, getIndex, getPost, getReelCover, getReelVideo, getSeasonWeek, getSky, getSkyRanking, getTalkImage, getTodayGuPage, getTodayPage, getTomorrowGuPage, getTomorrowPage, getWatchSummary, getWeatherNow, getWeatherToday, getWeek, getWeekRanking, googleLogin, healthzHealthzGet, importFortune, likeComment, likePost, likeTalk, listArticles, listBlocked, listCards, listComments, listEvents, listIndices, listMyGak, listMyTalks, listPlaces, listPresets, listReels, listRegions, listSaved, listShorts, listTalkComments, listTalks, listUsers, login, logout, match, me, myLevel, nearestRegion, type Options, publishCard, publishInstagram, publishInstagram2, putBirth, reading, refresh, rejectCard, reportComment, reportTalk, saveDayLog, savePost, scoreMyGak, searchFortunePlaces, shared, signup, talkGroups, toss, tossUnlink, unblock, unlikeComment, unlikePost, unlikeTalk, unsavePost, updateMe, uploadTalkImage, withdraw } from './sdk.gen';
|
||||
export { type AddCommentData, type AddCommentError, type AddCommentErrors, type AddCommentResponse, type AddCommentResponses, type AddMyGakData, type AddMyGakError, type AddMyGakErrors, type AddMyGakResponse, type AddMyGakResponses, type AddTalkCommentData, type AddTalkCommentError, type AddTalkCommentErrors, type AddTalkCommentResponse, type AddTalkCommentResponses, type AddTalkData, type AddTalkError, type AddTalkErrors, type AddTalkResponse, type AddTalkResponses, type AdminUser, type AgreeTermsData, type AgreeTermsError, type AgreeTermsErrors, type AgreeTermsResponse, type AgreeTermsResponses, type AirData, AirGrade, ArticleCategory, type ArticleSummary, type AttendData, type AttendError, type AttendErrors, type AttendResponse, type AttendResponses, type AuthConfigData, type AuthConfigResponse, type AuthConfigResponses, AuthProvider, type BandArticle, type BandEvent, type Bands, type BestTime, type BlockAuthorData, type BlockAuthorError, type BlockAuthorErrors, type BlockAuthorResponse, type BlockAuthorResponses, type BlockedUser, type BlockTalkAuthorData, type BlockTalkAuthorError, type BlockTalkAuthorErrors, type BlockTalkAuthorResponse, type BlockTalkAuthorResponses, type BodyUploadTalkImageV1TalkImagePost, type CardItem, CardStatus, type ClientOptions, type CommentData, type CommuteData, Confidence, type CreateCardData, type CreateCardError, type CreateCardErrors, type CreateCardResponse, type CreateCardResponses, type CreateReelData, type CreateReelError, type CreateReelErrors, type CreateReelResponse, type CreateReelResponses, type Cut, type DayData, type DayLogData, type DeleteBirthData, type DeleteBirthError, type DeleteBirthErrors, type DeleteBirthResponse, type DeleteBirthResponses, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteMyGakData, type DeleteMyGakError, type DeleteMyGakErrors, type DeleteMyGakResponse, type DeleteMyGakResponses, type DeleteTalkData, type DeleteTalkError, type DeleteTalkErrors, type DeleteTalkResponse, type DeleteTalkResponses, type DrawFortuneData, type DrawFortuneError, type DrawFortuneErrors, type DrawFortuneResponse, type DrawFortuneResponses, type ErrorInfo, type EventData, type Factor, type FortuneCard, type FortuneLuck, type FortunePlace, type GakSlide, type GameRoundData, type GameRoundError, type GameRoundErrors, type GameRoundResponse, type GameRoundResponses, type GameStartData, type GameStartError, type GameStartErrors, type GameStartResponse, type GameStartResponses, type GetArticleData, type GetArticleError, type GetArticleErrors, type GetArticleResponse, type GetArticleResponses, type GetBirthData, type GetBirthError, type GetBirthErrors, type GetBirthResponse, type GetBirthResponses, type GetCardImageData, type GetCardImageError, type GetCardImageErrors, type GetCardImageResponses, type GetFeedData, type GetFeedError, type GetFeedErrors, type GetFeedResponse, type GetFeedResponses, type GetFortuneTodayData, type GetFortuneTodayError, type GetFortuneTodayErrors, type GetFortuneTodayResponse, type GetFortuneTodayResponses, type GetImageData, type GetImageError, type GetImageErrors, type GetImageResponses, type GetIndexData, type GetIndexError, type GetIndexErrors, type GetIndexResponse, type GetIndexResponses, type GetPostData, type GetPostError, type GetPostErrors, type GetPostResponse, type GetPostResponses, type GetReelCoverData, type GetReelCoverError, type GetReelCoverErrors, type GetReelCoverResponses, type GetReelVideoData, type GetReelVideoError, type GetReelVideoErrors, type GetReelVideoResponses, type GetSeasonWeekData, type GetSeasonWeekResponse, type GetSeasonWeekResponses, type GetSkyData, type GetSkyError, type GetSkyErrors, type GetSkyRankingData, type GetSkyRankingResponse, type GetSkyRankingResponses, type GetSkyResponse, type GetSkyResponses, type GetTalkImageData, type GetTalkImageError, type GetTalkImageErrors, type GetTalkImageResponses, type GetTodayGuPageData, type GetTodayGuPageError, type GetTodayGuPageErrors, type GetTodayGuPageResponse, type GetTodayGuPageResponses, type GetTodayPageData, type GetTodayPageError, type GetTodayPageErrors, type GetTodayPageResponse, type GetTodayPageResponses, type GetTomorrowGuPageData, type GetTomorrowGuPageError, type GetTomorrowGuPageErrors, type GetTomorrowGuPageResponse, type GetTomorrowGuPageResponses, type GetTomorrowPageData, type GetTomorrowPageError, type GetTomorrowPageErrors, type GetTomorrowPageResponse, type GetTomorrowPageResponses, type GetWatchSummaryData, type GetWatchSummaryError, type GetWatchSummaryErrors, type GetWatchSummaryResponse, type GetWatchSummaryResponses, type GetWeatherNowData, type GetWeatherNowError, type GetWeatherNowErrors, type GetWeatherNowResponse, type GetWeatherNowResponses, type GetWeatherTodayData, type GetWeatherTodayError, type GetWeatherTodayErrors, type GetWeatherTodayResponse, type GetWeatherTodayResponses, type GetWeekData, type GetWeekError, type GetWeLine truncated
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';
|
||||
import { client } from './client.gen';
|
||||
import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkData, AddTalkErrors, AddTalkResponses, AgreeTermsData, AgreeTermsErrors, AgreeTermsResponses, AttendData, AttendErrors, AttendResponses, AuthConfigData, AuthConfigResponses, BlockAuthorData, BlockAuthorErrors, BlockAuthorResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, CreateCardData, CreateCardErrors, CreateCardResponses, CreateReelData, CreateReelErrors, CreateReelResponses, DeleteBirthData, DeleteBirthErrors, DeleteBirthResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, DrawFortuneData, DrawFortuneErrors, DrawFortuneResponses, GameRoundData, GameRoundErrors, GameRoundResponses, GameStartData, GameStartErrors, GameStartResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetBirthData, GetBirthErrors, GetBirthResponses, GetCardImageData, GetCardImageErrors, GetCardImageResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetFortuneTodayData, GetFortuneTodayErrors, GetFortuneTodayResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetReelCoverData, GetReelCoverErrors, GetReelCoverResponses, GetReelVideoData, GetReelVideoErrors, GetReelVideoResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTalkImageData, GetTalkImageErrors, GetTalkImageResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetTomorrowGuPageData, GetTomorrowGuPageErrors, GetTomorrowGuPageResponses, GetTomorrowPageData, GetTomorrowPageErrors, GetTomorrowPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, GoogleLoginData, GoogleLoginErrors, GoogleLoginResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, ImportFortuneData, ImportFortuneErrors, ImportFortuneResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListBlockedData, ListBlockedErrors, ListBlockedResponses, ListCardsData, ListCardsErrors, ListCardsResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListMyTalksData, ListMyTalksErrors, ListMyTalksResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListPresetsData, ListPresetsResponses, ListReelsData, ListReelsErrors, ListReelsResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListShortsData, ListShortsResponses, ListTalksData, ListTalksErrors, ListTalksResponses, ListUsersData, ListUsersErrors, ListUsersResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MatchData, MatchErrors, MatchResponses, MeData, MeErrors, MeResponses, MyLevelData, MyLevelErrors, MyLevelResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, PublishCardData, PublishCardErrors, PublishCardResponses, PublishInstagram2Data, PublishInstagram2Errors, PublishInstagram2Responses, PublishInstagramData, PublishInstagramErrors, PublishInstagramResponses, PutBirthData, PutBirthErrors, PutBirthResponses, ReadingData, ReadingErrors, ReadingResponses, RefreshData, RefreshErrors, RefreshResponses, RejectCardData, RejectCardErrors, RejectCardResponses, ReportCommentData, ReportCommentErrors, ReportCommentResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SaveDayLogData, SaveDayLogErrors, SaveDayLogResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SearchFortunePlacesData, SearchFortunePlacesErrors, SearchFortunePlacesResponses, SharedData, SharedErrors, SharedResponses, SignupData, SignupErrors, SignupResponses, TalkGroupsData, TalkGroupsErrors, TalkGroupsResponses, TossData, TossErrors, TossResponses, TossUnlinkData, TossUnlinkErrors, TossUnlinkResponses, UnblockData, UnblockErrors, UnblockResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkData, UnlikeTalkErrors, UnlikeTalkResponses, UnsavePostData, UnsavePostErrors, UnsavePostResponses, UpdateMeData, UpdateMeErrors, UpdateMeRespoLine truncated
|
||||
import type { AddCommentData, AddCommentErrors, AddCommentResponses, AddMyGakData, AddMyGakErrors, AddMyGakResponses, AddTalkCommentData, AddTalkCommentErrors, AddTalkCommentResponses, AddTalkData, AddTalkErrors, AddTalkResponses, AgreeTermsData, AgreeTermsErrors, AgreeTermsResponses, AttendData, AttendErrors, AttendResponses, AuthConfigData, AuthConfigResponses, BlockAuthorData, BlockAuthorErrors, BlockAuthorResponses, BlockTalkAuthorData, BlockTalkAuthorErrors, BlockTalkAuthorResponses, CreateCardData, CreateCardErrors, CreateCardResponses, CreateReelData, CreateReelErrors, CreateReelResponses, DeleteBirthData, DeleteBirthErrors, DeleteBirthResponses, DeleteCommentData, DeleteCommentErrors, DeleteCommentResponses, DeleteMyGakData, DeleteMyGakErrors, DeleteMyGakResponses, DeleteTalkData, DeleteTalkErrors, DeleteTalkResponses, DrawFortuneData, DrawFortuneErrors, DrawFortuneResponses, GameRoundData, GameRoundErrors, GameRoundResponses, GameStartData, GameStartErrors, GameStartResponses, GetArticleData, GetArticleErrors, GetArticleResponses, GetBirthData, GetBirthErrors, GetBirthResponses, GetCardImageData, GetCardImageErrors, GetCardImageResponses, GetFeedData, GetFeedErrors, GetFeedResponses, GetFortuneTodayData, GetFortuneTodayErrors, GetFortuneTodayResponses, GetImageData, GetImageErrors, GetImageResponses, GetIndexData, GetIndexErrors, GetIndexResponses, GetPostData, GetPostErrors, GetPostResponses, GetReelCoverData, GetReelCoverErrors, GetReelCoverResponses, GetReelVideoData, GetReelVideoErrors, GetReelVideoResponses, GetSeasonWeekData, GetSeasonWeekResponses, GetSkyData, GetSkyErrors, GetSkyRankingData, GetSkyRankingResponses, GetSkyResponses, GetTalkImageData, GetTalkImageErrors, GetTalkImageResponses, GetTodayGuPageData, GetTodayGuPageErrors, GetTodayGuPageResponses, GetTodayPageData, GetTodayPageErrors, GetTodayPageResponses, GetTomorrowGuPageData, GetTomorrowGuPageErrors, GetTomorrowGuPageResponses, GetTomorrowPageData, GetTomorrowPageErrors, GetTomorrowPageResponses, GetWatchSummaryData, GetWatchSummaryErrors, GetWatchSummaryResponses, GetWeatherNowData, GetWeatherNowErrors, GetWeatherNowResponses, GetWeatherTodayData, GetWeatherTodayErrors, GetWeatherTodayResponses, GetWeekData, GetWeekErrors, GetWeekRankingData, GetWeekRankingResponses, GetWeekResponses, GoogleLoginData, GoogleLoginErrors, GoogleLoginResponses, HealthzHealthzGetData, HealthzHealthzGetResponses, ImportFortuneData, ImportFortuneErrors, ImportFortuneResponses, LikeCommentData, LikeCommentErrors, LikeCommentResponses, LikePostData, LikePostErrors, LikePostResponses, LikeTalkData, LikeTalkErrors, LikeTalkResponses, ListArticlesData, ListArticlesErrors, ListArticlesResponses, ListBlockedData, ListBlockedErrors, ListBlockedResponses, ListCardsData, ListCardsErrors, ListCardsResponses, ListCommentsData, ListCommentsErrors, ListCommentsResponses, ListEventsData, ListEventsErrors, ListEventsResponses, ListIndicesData, ListIndicesErrors, ListIndicesResponses, ListMyGakData, ListMyGakErrors, ListMyGakResponses, ListMyTalksData, ListMyTalksErrors, ListMyTalksResponses, ListPlacesData, ListPlacesErrors, ListPlacesResponses, ListPresetsData, ListPresetsResponses, ListReelsData, ListReelsErrors, ListReelsResponses, ListRegionsData, ListRegionsErrors, ListRegionsResponses, ListSavedData, ListSavedErrors, ListSavedResponses, ListShortsData, ListShortsResponses, ListTalkCommentsData, ListTalkCommentsErrors, ListTalkCommentsResponses, ListTalksData, ListTalksErrors, ListTalksResponses, ListUsersData, ListUsersErrors, ListUsersResponses, LoginData, LoginErrors, LoginResponses, LogoutData, LogoutErrors, LogoutResponses, MatchData, MatchErrors, MatchResponses, MeData, MeErrors, MeResponses, MyLevelData, MyLevelErrors, MyLevelResponses, NearestRegionData, NearestRegionErrors, NearestRegionResponses, PublishCardData, PublishCardErrors, PublishCardResponses, PublishInstagram2Data, PublishInstagram2Errors, PublishInstagram2Responses, PublishInstagramData, PublishInstagramErrors, PublishInstagramResponses, PutBirthData, PutBirthErrors, PutBirthResponses, ReadingData, ReadingErrors, ReadingResponses, RefreshData, RefreshErrors, RefreshResponses, RejectCardData, RejectCardErrors, RejectCardResponses, ReportCommentData, ReportCommentErrors, ReportCommentResponses, ReportTalkData, ReportTalkErrors, ReportTalkResponses, SaveDayLogData, SaveDayLogErrors, SaveDayLogResponses, SavePostData, SavePostErrors, SavePostResponses, ScoreMyGakData, ScoreMyGakErrors, ScoreMyGakResponses, SearchFortunePlacesData, SearchFortunePlacesErrors, SearchFortunePlacesResponses, SharedData, SharedErrors, SharedResponses, SignupData, SignupErrors, SignupResponses, TalkGroupsData, TalkGroupsErrors, TalkGroupsResponses, TossData, TossErrors, TossResponses, TossUnlinkData, TossUnlinkErrors, TossUnlinkResponses, UnblockData, UnblockErrors, UnblockResponses, UnlikeCommentData, UnlikeCommentErrors, UnlikeCommentResponses, UnlikePostData, UnlikePostErrors, UnlikePostResponses, UnlikeTalkDatLine truncated
|
||||
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
||||
/**
|
||||
@@ -254,6 +254,23 @@ export const addComment = <ThrowOnError extends boolean = true>(options: Options
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 사람 글 댓글 목록 (로그인 없이 보기)
|
||||
*/
|
||||
export const listTalkComments = <ThrowOnError extends boolean = true>(options: Options<ListTalkCommentsData, ThrowOnError>): RequestResult<ListTalkCommentsResponses, ListTalkCommentsErrors, ThrowOnError> => (options.client ?? client).get<ListTalkCommentsResponses, ListTalkCommentsErrors, ThrowOnError>({ url: '/v1/reaction/talk/{talk_id}/comment/list', ...options });
|
||||
|
||||
/**
|
||||
* 사람 글 댓글 쓰기 (로그인한 사람만, 60자, 링크·전화번호 불가, 이용약관 동의 전이면 TERMS_REQUIRED). 지우기·좋아요·신고·차단은 /comment/{comment_id} 그대로
|
||||
*/
|
||||
export const addTalkComment = <ThrowOnError extends boolean = true>(options: Options<AddTalkCommentData, ThrowOnError>): RequestResult<AddTalkCommentResponses, AddTalkCommentErrors, ThrowOnError> => (options.client ?? client).post<AddTalkCommentResponses, AddTalkCommentErrors, ThrowOnError>({
|
||||
url: '/v1/reaction/talk/{talk_id}/comment',
|
||||
...options,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...options.headers
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 내 댓글 지우기 (로그인 없이 쓴 댓글은 같은 IP 에서)
|
||||
*/
|
||||
|
||||
@@ -4482,6 +4482,10 @@ export type TalkData = {
|
||||
* Like Count
|
||||
*/
|
||||
like_count: number;
|
||||
/**
|
||||
* Comment Count
|
||||
*/
|
||||
comment_count?: number;
|
||||
/**
|
||||
* Liked
|
||||
*/
|
||||
@@ -6267,6 +6271,83 @@ export type AddCommentResponses = {
|
||||
|
||||
export type AddCommentResponse = AddCommentResponses[keyof AddCommentResponses];
|
||||
|
||||
export type ListTalkCommentsData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
/**
|
||||
* Authorization
|
||||
*/
|
||||
authorization?: string | null;
|
||||
};
|
||||
path: {
|
||||
/**
|
||||
* Talk Id
|
||||
*/
|
||||
talk_id: number;
|
||||
};
|
||||
query?: {
|
||||
/**
|
||||
* Cursor
|
||||
*/
|
||||
cursor?: number | null;
|
||||
};
|
||||
url: '/v1/reaction/talk/{talk_id}/comment/list';
|
||||
};
|
||||
|
||||
export type ListTalkCommentsErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type ListTalkCommentsError = ListTalkCommentsErrors[keyof ListTalkCommentsErrors];
|
||||
|
||||
export type ListTalkCommentsResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResCommentList;
|
||||
};
|
||||
|
||||
export type ListTalkCommentsResponse = ListTalkCommentsResponses[keyof ListTalkCommentsResponses];
|
||||
|
||||
export type AddTalkCommentData = {
|
||||
body: ReqComment;
|
||||
headers?: {
|
||||
/**
|
||||
* Authorization
|
||||
*/
|
||||
authorization?: string | null;
|
||||
};
|
||||
path: {
|
||||
/**
|
||||
* Talk Id
|
||||
*/
|
||||
talk_id: number;
|
||||
};
|
||||
query?: never;
|
||||
url: '/v1/reaction/talk/{talk_id}/comment';
|
||||
};
|
||||
|
||||
export type AddTalkCommentErrors = {
|
||||
/**
|
||||
* Validation Error
|
||||
*/
|
||||
422: HttpValidationError;
|
||||
};
|
||||
|
||||
export type AddTalkCommentError = AddTalkCommentErrors[keyof AddTalkCommentErrors];
|
||||
|
||||
export type AddTalkCommentResponses = {
|
||||
/**
|
||||
* Successful Response
|
||||
*/
|
||||
200: ResComment;
|
||||
};
|
||||
|
||||
export type AddTalkCommentResponse = AddTalkCommentResponses[keyof AddTalkCommentResponses];
|
||||
|
||||
export type DeleteCommentData = {
|
||||
body?: never;
|
||||
headers?: {
|
||||
|
||||
Reference in new issue
Block a user