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
@@ -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))
|
||||
Reference in new issue
Block a user