This commit is contained in:
toom1996
2026-08-30 10:45:34 +08:00
parent a6724265ad
commit 9c3403a903
23 changed files with 284 additions and 508 deletions

View File

@ -1,18 +1,5 @@
package dto
// ---------- 请求 ----------
// AuthRequest 注册 / 登录的统一请求体。
//
// 沿用原项目的单结构设计:注册用 username + email + password,
// 登录用 account(可填邮箱或用户名)+ password。
type AuthRequest struct {
Username string `json:"username"`
Email string `json:"email"`
Password string `json:"password"`
Account string `json:"account"`
}
// ---------- 响应 ----------
// UserPayload 对外返回的用户信息,绝不包含密码哈希。
@ -21,10 +8,3 @@ type UserPayload struct {
Username string `json:"username"`
Email string `json:"email"`
}
// AuthResult 注册 / 登录成功后的返回:令牌 + 用户信息。
// 前端 src/lib/auth.ts 依赖 token 与 user 两个顶层字段。
type AuthResult struct {
Token string `json:"token"`
User UserPayload `json:"user"`
}