chore: resolve WIP after merging internal/development

- .gitignore: keep api/uploads ignore and copyright_source_listing.pdf path

- auth: keep COS avatar upload URL; delete prior COS object when applying preset

- i18n: regenerate resources.ts (includes profile tapAwayToClose)

- Avatar/COS tests and personal-info remain from prior local work

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin
2026-05-18 15:34:50 +08:00
parent 98802240ac
commit eabda2c6a9
12 changed files with 350 additions and 97 deletions

View File

@@ -51,6 +51,10 @@ async def clear_user_demographics(db: AsyncSession, user_id: str) -> None:
)
async def clear_user_avatar_url(db: AsyncSession, user_id: str) -> None:
await db.execute(update(User).where(User.id == user_id).values(avatar_url=None))
async def collect_purge_context(
db: AsyncSession, user_id: str
) -> tuple[list[str], list[str], list[str]]:
@@ -130,6 +134,13 @@ async def collect_object_storage_keys_before_purge(
tts_urls if isinstance(tts_urls, list) else None
)
r_av = await db.execute(select(User.avatar_url).where(User.id == user_id))
avatar_url_val = r_av.scalar_one_or_none()
if avatar_url_val:
ak = extract_cos_object_key_if_owned(avatar_url_val)
if ak:
keys.add(ak)
return sorted(keys)

View File

@@ -3,6 +3,7 @@ import uuid
from fastapi import APIRouter, Depends, HTTPException, status
from app.core.config import settings
from app.core.cos_url_keys import avatar_url_for_api_response
from app.core.dependencies import get_current_user, get_object_storage
from app.core.logging import get_logger
from app.features.user.deps import get_user_service
@@ -50,7 +51,7 @@ async def get_user_profile(
phone=current_user.phone,
email=current_user.email,
nickname=current_user.nickname,
avatar_url=current_user.avatar_url,
avatar_url=avatar_url_for_api_response(current_user.avatar_url),
subscription_type=current_user.subscription_type,
created_at=current_user.created_at.isoformat(),
birth_year=current_user.birth_year,

View File

@@ -2,6 +2,7 @@ from datetime import timedelta
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.cos_url_keys import avatar_url_for_api_response
from app.core.db import utc_now
from app.core.logging import get_logger
from app.core.redis import redis_service
@@ -32,7 +33,7 @@ def _user_to_profile(user: User) -> UserProfileResponse:
phone=user.phone,
email=user.email,
nickname=user.nickname,
avatar_url=user.avatar_url,
avatar_url=avatar_url_for_api_response(user.avatar_url),
subscription_type=user.subscription_type,
created_at=user.created_at.isoformat(),
birth_year=user.birth_year,
@@ -121,6 +122,7 @@ class UserService:
await repo.purge_user_related_rows(self._db, user_id)
await repo.clear_user_demographics(self._db, user_id)
await repo.clear_user_avatar_url(self._db, user_id)
await self._db.commit()
logger.info("用户数据 DB 行已删除、档案字段已清空并提交 user_id={}", user_id)