Files
tyapi-server/internal/application/user/dto/commands/user_commands.go

68 lines
3.4 KiB
Go
Raw Normal View History

2025-07-13 16:36:20 +08:00
package commands
// RegisterUserCommand 用户注册命令
// @Description 用户注册请求参数
type RegisterUserCommand struct {
2025-07-20 20:53:26 +08:00
Phone string `json:"phone" binding:"required,phone" example:"13800138000"`
Password string `json:"password" binding:"required,strong_password" example:"Password123"`
ConfirmPassword string `json:"confirm_password" binding:"required,eqfield=Password" example:"Password123"`
2025-07-13 16:36:20 +08:00
Code string `json:"code" binding:"required,len=6" example:"123456"`
}
// LoginWithPasswordCommand 密码登录命令
// @Description 使用密码进行用户登录请求参数
type LoginWithPasswordCommand struct {
2025-07-20 20:53:26 +08:00
Phone string `json:"phone" binding:"required,phone" example:"13800138000"`
Password string `json:"password" binding:"required,min=6,max=128" example:"Password123"`
2025-07-13 16:36:20 +08:00
}
// LoginWithSMSCommand 短信验证码登录命令
// @Description 使用短信验证码进行用户登录请求参数
type LoginWithSMSCommand struct {
2025-07-20 20:53:26 +08:00
Phone string `json:"phone" binding:"required,phone" example:"13800138000"`
2025-07-13 16:36:20 +08:00
Code string `json:"code" binding:"required,len=6" example:"123456"`
}
// ChangePasswordCommand 修改密码命令
// @Description 修改用户密码请求参数
type ChangePasswordCommand struct {
UserID string `json:"-"`
2025-07-20 20:53:26 +08:00
OldPassword string `json:"old_password" binding:"required,min=6,max=128" example:"OldPassword123"`
NewPassword string `json:"new_password" binding:"required,strong_password" example:"NewPassword123"`
ConfirmNewPassword string `json:"confirm_new_password" binding:"required,eqfield=NewPassword" example:"NewPassword123"`
2025-07-13 16:36:20 +08:00
Code string `json:"code" binding:"required,len=6" example:"123456"`
}
2025-07-15 13:21:34 +08:00
// ResetPasswordCommand 重置密码命令
// @Description 重置用户密码请求参数(忘记密码时使用)
type ResetPasswordCommand struct {
2025-07-20 20:53:26 +08:00
Phone string `json:"phone" binding:"required,phone" example:"13800138000"`
NewPassword string `json:"new_password" binding:"required,strong_password" example:"NewPassword123"`
ConfirmNewPassword string `json:"confirm_new_password" binding:"required,eqfield=NewPassword" example:"NewPassword123"`
2025-07-15 13:21:34 +08:00
Code string `json:"code" binding:"required,len=6" example:"123456"`
}
2025-07-13 16:36:20 +08:00
// SendCodeCommand 发送验证码命令
// @Description 发送短信验证码请求参数
type SendCodeCommand struct {
2025-07-20 20:53:26 +08:00
Phone string `json:"phone" binding:"required,phone" example:"13800138000"`
Scene string `json:"scene" binding:"required,oneof=register login change_password reset_password bind unbind certification" example:"register"`
2025-07-13 16:36:20 +08:00
}
// UpdateProfileCommand 更新用户信息命令
// @Description 更新用户基本信息请求参数
type UpdateProfileCommand struct {
2025-07-20 20:53:26 +08:00
UserID string `json:"-"`
Phone string `json:"phone" binding:"omitempty,phone" example:"13800138000"`
DisplayName string `json:"display_name" binding:"omitempty,min=2,max=50" example:"用户昵称"`
Email string `json:"email" binding:"omitempty,email" example:"user@example.com"`
2025-07-13 16:36:20 +08:00
}
// VerifyCodeCommand 验证验证码命令
// @Description 验证短信验证码请求参数
type VerifyCodeCommand struct {
2025-07-20 20:53:26 +08:00
Phone string `json:"phone" binding:"required,phone" example:"13800138000"`
2025-07-13 16:36:20 +08:00
Code string `json:"code" binding:"required,len=6" example:"123456"`
2025-07-20 20:53:26 +08:00
Scene string `json:"scene" binding:"required,oneof=register login change_password reset_password bind unbind certification" example:"register"`
2025-07-13 16:36:20 +08:00
}