package dto import "time" // UserDTO 用户 DTO type UserDTO struct { ID string `json:"id"` Username string `json:"username"` Email string `json:"email,omitempty"` Role string `json:"role"` WorkspaceID string `json:"workspace_id,omitempty"` WorkspaceName string `json:"workspace_name,omitempty"` IsActive bool `json:"is_active"` MustChangePassword bool `json:"must_change_password"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // CreateUserRequest 创建用户请求(Admin 操作) type CreateUserRequest struct { Username string `json:"username" validate:"required"` Password string `json:"password" validate:"required,min=6"` Email string `json:"email"` Role string `json:"role" validate:"required,oneof=admin user"` WorkspaceID string `json:"workspace_id"` } // UpdateUserRequest 更新用户请求 type UpdateUserRequest struct { Email string `json:"email"` IsActive *bool `json:"is_active"` } // ChangeUserWorkspaceRequest 分配用户到 Workspace 请求 type ChangeUserWorkspaceRequest struct { WorkspaceID string `json:"workspace_id" validate:"required"` } // ResetPasswordRequest 重置密码请求 type ResetPasswordRequest struct { NewPassword string `json:"new_password" validate:"required,min=6"` } // ChangePasswordRequest 修改密码请求 type ChangePasswordRequest struct { OldPassword string `json:"old_password" validate:"required"` NewPassword string `json:"new_password" validate:"required,min=6"` } // SetUserActiveRequest 启用/禁用用户请求 type SetUserActiveRequest struct { IsActive bool `json:"is_active"` } // UserListResponse 用户列表响应 type UserListResponse struct { Users []*UserDTO `json:"users"` Total int `json:"total"` } // UserWithWorkspaceResponse 用户及其 Workspace 响应 type UserWithWorkspaceResponse struct { User *UserDTO `json:"user"` Workspace *WorkspaceDTO `json:"workspace,omitempty"` } // LoginResponse 登录响应 type LoginResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresIn int `json:"expires_in"` MustChangePassword bool `json:"must_change_password"` } // UserResponseWithDTO 用户响应(包含完整DTO) type UserResponseWithDTO struct { User *UserDTO `json:"user"` }