dacb37e3e1
- onboarding_completion 表(user_id+device_id 唯一约束)+ model + repository - POST /api/v1/user/onboarding/complete 标记完成;登录响应 TokenWithUser.onboarding_completed (按登录请求带的 device_id 判定是否已走过引导,跨卸载重装稳定) - alembic 迁移 onboarding_completion(rebase 到最新 main 后已链在 coupon_daily_completion 之后,单 head) - docs/database 文档 + tests/test_onboarding.py + run.bat(本地启动脚本) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
815 B
Python
28 lines
815 B
Python
"""用户资料(昵称/头像)相关请求 schemas。响应复用 [auth.UserOut]。"""
|
|
from __future__ import annotations
|
|
|
|
from pydantic import BaseModel, Field, field_validator
|
|
|
|
|
|
class ProfileUpdateRequest(BaseModel):
|
|
nickname: str = Field(..., min_length=1, max_length=16, description="昵称,1-16 字")
|
|
|
|
@field_validator("nickname")
|
|
@classmethod
|
|
def _strip_non_blank(cls, v: str) -> str:
|
|
v = v.strip()
|
|
if not v:
|
|
raise ValueError("昵称不能为空")
|
|
return v
|
|
|
|
|
|
class OnboardingCompleteRequest(BaseModel):
|
|
device_id: str = Field(
|
|
..., min_length=1, max_length=64,
|
|
description="硬件级设备标识(Android ANDROID_ID),与登录时一致,用于按 设备+账号 标记引导完成",
|
|
)
|
|
|
|
|
|
class OkResponse(BaseModel):
|
|
ok: bool = True
|