Merge branch 'react-native' into release/1026-merge

# Conflicts:
#	backend/common/enums.py
#	backend/router/v1/auth/account.py
#	frontend/.dockerignore
#	frontend/package-lock.json
#	frontend/package.json
#	frontend/public/terms.html
#	frontend/src/api/client/index.ts
#	frontend/src/b/BLayout.tsx
#	frontend/src/b/Sheets.tsx
#	shared/api/client/@tanstack/react-query.gen.ts
#	shared/api/client/sdk.gen.ts
#	shared/api/client/types.gen.ts
This commit is contained in:
minaChoi committed 2026-10-26 15:36:05 +09:00
commit 5d18fa51fa
148 files changed
+21940 -4532

No files matched your search

+10
View File
@@ -127,6 +127,16 @@ class AuthService:
"""이 사용자의 모든 기기 토큰을 무효로 만든다."""
return await DB_SESSION_MNG.execute_lambda_run([lambda s: self.crud.update(s, user.user_id, {"token_version": user.token_version + 1})])
async def agree_terms(self, user: User) -> tuple[ErrorType, Optional[User]]:
err = await DB_SESSION_MNG.execute_lambda_run([lambda s: self.crud.agree_terms(s, user.user_id)])
if err is not ErrorType.SUCCESS:
return err, None
return await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.get(s, user.user_id))
async def withdraw(self, user: User) -> ErrorType:
"""탈퇴: 계정과 남긴 댓글·좋아요를 한 번에 지운다. 계정이 없어지니 가진 토큰도 바로 못 쓴다."""
return await DB_SESSION_MNG.execute_lambda_run([lambda s: self.crud.withdraw(s, user.user_id)])
async def update_me(self, user: User, nickname: Optional[str], character: Optional[str], color: Optional[str] = None, mood: Optional[str] = None) -> tuple[ErrorType, Optional[User]]:
"""닉네임·캐릭터·배경색·기분 중 보낸 것만 바꾼다. 기분을 빈 문자열로 보내면 지운다."""
values: dict = {}
+39 -2
View File
@@ -1,3 +1,4 @@
import uuid
from dataclasses import dataclass
from datetime import datetime
from typing import Optional
@@ -6,7 +7,7 @@ from fastapi import Depends
from common.database.db_session_manager import DB_SESSION_MNG
from common.database.model.models import Comment, Post, User
from common.enums import ErrorType
from common.enums import ErrorType, ReportReason
from common.liker import Liker
from common.utils.kma_time import kst_midnight, now_kst
from crud.feed_crud import FeedCRUD
@@ -92,7 +93,7 @@ class ReactionService:
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, cursor, PAGE))
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))
if err is not ErrorType.SUCCESS:
return err, []
liked: set[int] = set()
@@ -109,6 +110,8 @@ class ReactionService:
body = body.strip()
if not body or len(body) > COMMENT_MAX:
return ErrorType.INVALID_INPUT, None
if user is not None and user.terms_agreed_at is None:
return ErrorType.TERMS_REQUIRED, None
err = await self._post_exists(post_id)
if err is not ErrorType.SUCCESS:
return err, None
@@ -145,3 +148,37 @@ class ReactionService:
if err is not ErrorType.SUCCESS:
return err, None
return (ErrorType.NOT_FOUND, None) if count is None else (ErrorType.SUCCESS, count)
async def _others_comment(self, comment_id: int, user: User) -> tuple[ErrorType, Optional[uuid.UUID]]:
"""남이 쓴, 지금 보이는 댓글의 작성자. 내 댓글이면 INVALID_INPUT, 로그인 없이 쓴 댓글이면 작성자는 None."""
err, author = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.comment_author(s, comment_id))
if err is not ErrorType.SUCCESS:
return err, None
if author is None:
return ErrorType.NOT_FOUND, None
return (ErrorType.INVALID_INPUT, None) if author.user_id == user.user_id else (ErrorType.SUCCESS, author.user_id)
async def report_comment(self, comment_id: int, user: User, reason: ReportReason) -> ErrorType:
err, _ = await self._others_comment(comment_id, user)
if err is not ErrorType.SUCCESS:
return err
return await DB_SESSION_MNG.execute_lambda_run([lambda s: self.crud.report_comment(s, comment_id, user.user_id, reason.value)])
async def block_author(self, comment_id: int, user: User) -> ErrorType:
err, author = await self._others_comment(comment_id, user)
if err is not ErrorType.SUCCESS:
return err
# 로그인 없이 쓴 댓글은 차단할 사람이 없어 신고만 받는다
if author is None:
return ErrorType.INVALID_INPUT
return await DB_SESSION_MNG.execute_lambda_run([lambda s: self.crud.block(s, user.user_id, author)])
async def unblock(self, user: User, blocked_id: uuid.UUID) -> ErrorType:
err, ok = await DB_SESSION_MNG.execute_lambda_write(lambda s: self.crud.unblock(s, user.user_id, blocked_id))
if err is not ErrorType.SUCCESS:
return err
return ErrorType.SUCCESS if ok else ErrorType.NOT_FOUND
async def blocked(self, user: User) -> tuple[ErrorType, list[User]]:
err, users = await DB_SESSION_MNG.execute_lambda(lambda s: self.crud.blocked(s, user.user_id))
return err, users or []