e8bd12cc1f
废弃 force_onboarding(运营按用户强制引导,客户端不认——被 onboarding_completed 压过), 改用 onboarding_completion(设备+账号 维度),admin 直接增删该表记录控制重走。 - 删 force_onboarding: User 列 + auth/admin schema + admin 接口 + mutations + repo clear + /onboarding/complete 调用 + 3 测试;新增 alembic 迁移删列 - admin 设备管理: 列设备(按 device 聚合) / 重置单设备 / 全部重置(清 onboarding_completion) - 新增 GET /api/v1/user/onboarding/status: 客户端已登录启动查"本设备是否要重走引导" Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
"""admin 用户管理 schemas。"""
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class AdminUserListItem(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
phone: str
|
|
nickname: str | None = None
|
|
register_channel: str
|
|
status: str
|
|
debug_trace_enabled: bool = False
|
|
wechat_openid: str | None = None
|
|
created_at: datetime
|
|
last_login_at: datetime
|
|
|
|
|
|
class AdminUserOverview(BaseModel):
|
|
"""用户 360 概览:基础资料 + 钱包余额 + 各项 count(历史明细走各自分页接口)。"""
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
user: AdminUserListItem
|
|
coin_balance: int
|
|
cash_balance_cents: int
|
|
total_coin_earned: int
|
|
comparison_total: int
|
|
comparison_success: int
|
|
withdraw_total: int
|
|
withdraw_success_cents: int
|
|
feedback_total: int
|
|
|
|
|
|
class GrantCoinsRequest(BaseModel):
|
|
amount: int = Field(..., description="金币变动:正=增加,负=扣减(不可为 0)")
|
|
reason: str = Field(..., min_length=1, max_length=128, description="操作原因(必填,入审计)")
|
|
|
|
|
|
class GrantCashRequest(BaseModel):
|
|
amount_cents: int = Field(..., description="现金变动(分):正=增加,负=扣减(不可为 0)")
|
|
reason: str = Field(..., min_length=1, max_length=128, description="操作原因(必填,入审计)")
|
|
|
|
|
|
class SetUserStatusRequest(BaseModel):
|
|
status: Literal["active", "disabled"] = Field(
|
|
..., description="active=解封 / disabled=封禁(注销 deleted 不走此接口)"
|
|
)
|
|
|
|
|
|
class SetDebugTraceRequest(BaseModel):
|
|
enabled: bool = Field(..., description="是否给该用户开「复制调试链接」权限")
|