Files
junhong_cmp_fiber/internal/model/auth_dto.go
huang 4abbf558e4
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m28s
完善 DTO 规范:统一 description 标签并添加 AI 助手自动检查指引
- 修复所有 DTO 文件的 description 标签(10 个文件)
  - 枚举字段统一使用中文说明(用户类型、角色类型、权限类型等)
  - 状态字段明确说明 0/1 含义
  - validate 标签与 OpenAPI 标签保持一致

- 在 AGENTS.md 和 CLAUDE.md 添加 DTO 规范章节
  - AI 助手必须执行的 7 项检查清单
  - 常见枚举字段标准值参考
  - 确保未来 AI 助手自动遵循规范

- 创建规范文档
  - docs/code-review-checklist.md(Code Review 检查清单)
  - docs/dto-improvement-summary.md(DTO 改进总结)
  - docs/ai-dto-guidelines-update.md(AI 指引更新说明)

- 重新生成 OpenAPI 文档(375 个 description 标签)

影响:所有 API 字段现在都有清晰的中文说明,前端开发更友好
2026-01-20 15:10:11 +08:00

42 lines
1.6 KiB
Go

package model
type LoginRequest struct {
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
Device string `json:"device" validate:"omitempty,oneof=web h5 mobile"`
}
type LoginResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int64 `json:"expires_in"`
User UserInfo `json:"user"`
Permissions []string `json:"permissions"`
}
type UserInfo struct {
ID uint `json:"id" description:"用户ID"`
Username string `json:"username" description:"用户名"`
Phone string `json:"phone" description:"手机号"`
UserType int `json:"user_type" description:"用户类型 (1:超级管理员, 2:平台用户, 3:代理账号, 4:企业账号)"`
UserTypeName string `json:"user_type_name" description:"用户类型名称"`
ShopID uint `json:"shop_id,omitempty" description:"店铺ID"`
ShopName string `json:"shop_name,omitempty" description:"店铺名称"`
EnterpriseID uint `json:"enterprise_id,omitempty" description:"企业ID"`
EnterpriseName string `json:"enterprise_name,omitempty" description:"企业名称"`
}
type RefreshTokenRequest struct {
RefreshToken string `json:"refresh_token" validate:"required"`
}
type RefreshTokenResponse struct {
AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in"`
}
type ChangePasswordRequest struct {
OldPassword string `json:"old_password" validate:"required"`
NewPassword string `json:"new_password" validate:"required,min=8,max=32"`
}