初始化
This commit is contained in:
247
server/dto/admin_dto.go
Normal file
247
server/dto/admin_dto.go
Normal file
@@ -0,0 +1,247 @@
|
||||
package dto
|
||||
|
||||
// ========== 用户管理 ==========
|
||||
|
||||
// UserCreateRequest 创建用户请求
|
||||
type UserCreateRequest struct {
|
||||
Username string `json:"username" binding:"required,min=3,max=64"`
|
||||
Password string `json:"password"` // 可选, 留空则使用默认密码
|
||||
Email string `json:"email"`
|
||||
Nickname string `json:"nickname"`
|
||||
RoleIDs []uint64 `json:"role_ids"` // 角色ID列表
|
||||
DeptID uint64 `json:"dept_id"` // 部门ID
|
||||
StorageQuota int64 `json:"storage_quota"` // 存储配额(字节)
|
||||
}
|
||||
|
||||
// UserUpdateRequest 更新用户请求
|
||||
type UserUpdateRequest struct {
|
||||
Email string `json:"email"`
|
||||
Nickname string `json:"nickname"`
|
||||
Status *int8 `json:"status"` // 指针区分零值和未传
|
||||
RoleIDs []uint64 `json:"role_ids"`
|
||||
DeptID uint64 `json:"dept_id"`
|
||||
StorageQuota *int64 `json:"storage_quota"`
|
||||
}
|
||||
|
||||
// UserVO 用户视图对象(管理后台)
|
||||
type UserVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Status int8 `json:"status"`
|
||||
StorageQuota int64 `json:"storage_quota"`
|
||||
UsedStorage int64 `json:"used_storage"`
|
||||
DeptID uint64 `json:"dept_id"`
|
||||
DeptName string `json:"dept_name"`
|
||||
Roles []RoleVO `json:"roles"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
// ========== 存储策略管理 ==========
|
||||
|
||||
// StoragePolicyCreateRequest 创建存储策略请求
|
||||
type StoragePolicyCreateRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
Type string `json:"type" binding:"required,oneof=local minio s3 oss"`
|
||||
PolicyType string `json:"policy_type" binding:"required,oneof=hot cold public slave"` // 热存储/冷存储/公开/扩展
|
||||
Config PolicyConfigDTO `json:"config" binding:"required"`
|
||||
}
|
||||
|
||||
// StoragePolicyUpdateRequest 更新存储策略请求
|
||||
type StoragePolicyUpdateRequest struct {
|
||||
Name string `json:"name"`
|
||||
Status *int8 `json:"status"`
|
||||
Config *PolicyConfigDTO `json:"config"`
|
||||
}
|
||||
|
||||
// PolicyConfigDTO 存储策略配置
|
||||
type PolicyConfigDTO struct {
|
||||
BasePath string `json:"base_path,omitempty"`
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
AccessKey string `json:"access_key,omitempty"`
|
||||
SecretKey string `json:"secret_key,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
UseSSL bool `json:"use_ssl,omitempty"`
|
||||
}
|
||||
|
||||
// StoragePolicyVO 存储策略视图对象
|
||||
type StoragePolicyVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"` // local/minio/s3/oss
|
||||
PolicyType string `json:"policy_type"` // hot/cold/public/slave
|
||||
Status int8 `json:"status"`
|
||||
Config PolicyConfigDTO `json:"config"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
// StorageAssignmentVO 存储策略分配视图对象
|
||||
type StorageAssignmentVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
PolicyID uint64 `json:"policy_id"`
|
||||
PolicyName string `json:"policy_name"`
|
||||
UserID uint64 `json:"user_id,omitempty"`
|
||||
UserName string `json:"user_name,omitempty"`
|
||||
GroupID uint64 `json:"group_id,omitempty"`
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
IsDefault int8 `json:"is_default"`
|
||||
Priority int `json:"priority"` // 优先级, 越大越优先
|
||||
StorageQuota int64 `json:"storage_quota"`
|
||||
AccessMode string `json:"access_mode"`
|
||||
Status int8 `json:"status"`
|
||||
}
|
||||
|
||||
// StorageAssignRequest 分配存储策略请求
|
||||
type StorageAssignRequest struct {
|
||||
PolicyID uint64 `json:"policy_id" binding:"required"`
|
||||
UserID uint64 `json:"user_id"`
|
||||
GroupID uint64 `json:"group_id"`
|
||||
IsDefault int8 `json:"is_default"`
|
||||
Priority int `json:"priority"` // 优先级
|
||||
StorageQuota int64 `json:"storage_quota"`
|
||||
AccessMode string `json:"access_mode"`
|
||||
}
|
||||
|
||||
// UserStorageInfoVO 用户存储信息
|
||||
type UserStorageInfoVO struct {
|
||||
PolicyID uint64 `json:"policy_id"`
|
||||
PolicyName string `json:"policy_name"`
|
||||
PolicyType string `json:"policy_type"`
|
||||
StorageQuota int64 `json:"storage_quota"`
|
||||
UsedStorage int64 `json:"used_storage"`
|
||||
UsedPercent float64 `json:"used_percent"`
|
||||
}
|
||||
|
||||
// ========== 开放平台 ==========
|
||||
|
||||
// AppVO 应用视图对象
|
||||
type AppVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
AppID string `json:"app_id"`
|
||||
AppSecret string `json:"app_secret,omitempty"`
|
||||
AppName string `json:"app_name"`
|
||||
Status int8 `json:"status"`
|
||||
Users []AppUserVO `json:"users,omitempty"` // 绑定的用户
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
// AppUserVO 应用绑定用户
|
||||
type AppUserVO struct {
|
||||
UserID uint64 `json:"user_id"`
|
||||
Username string `json:"username"`
|
||||
Nickname string `json:"nickname"`
|
||||
}
|
||||
|
||||
// AppCreateRequest 创建应用请求
|
||||
type AppCreateRequest struct {
|
||||
AppName string `json:"app_name" binding:"required"`
|
||||
}
|
||||
|
||||
// AppBindUsersRequest 绑定用户请求
|
||||
type AppBindUsersRequest struct {
|
||||
UserIDs []uint64 `json:"user_ids" binding:"required"`
|
||||
}
|
||||
|
||||
// ========== 操作日志 ==========
|
||||
|
||||
// OperationLogVO 操作日志视图对象
|
||||
type OperationLogVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
UserID uint64 `json:"user_id"`
|
||||
Username string `json:"username"`
|
||||
Action string `json:"action"`
|
||||
Resource string `json:"resource"`
|
||||
Detail string `json:"detail"`
|
||||
IP string `json:"ip"`
|
||||
Status int `json:"status"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
// LogCleanRequest 日志清理请求
|
||||
type LogCleanRequest struct {
|
||||
Days int `json:"days" binding:"required,min=1"` // 保留最近N天
|
||||
}
|
||||
|
||||
// ========== 备份管理 ==========
|
||||
|
||||
// BackupPolicyCreateRequest 创建备份策略请求
|
||||
type BackupPolicyCreateRequest struct {
|
||||
Name string `json:"name" binding:"required"`
|
||||
BackupType string `json:"backup_type" binding:"required,oneof=full incremental"`
|
||||
TargetType string `json:"target_type" binding:"required,oneof=local minio"`
|
||||
TargetConfig string `json:"target_config"` // JSON字符串
|
||||
IncludeDB int8 `json:"include_db"`
|
||||
IncludeFiles int8 `json:"include_files"`
|
||||
CronExpr string `json:"cron_expr"`
|
||||
MaxBackups int `json:"max_backups"`
|
||||
}
|
||||
|
||||
// BackupPolicyVO 备份策略视图
|
||||
type BackupPolicyVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
BackupType string `json:"backup_type"`
|
||||
TargetType string `json:"target_type"`
|
||||
TargetConfig string `json:"target_config"`
|
||||
IncludeDB int8 `json:"include_db"`
|
||||
IncludeFiles int8 `json:"include_files"`
|
||||
CronExpr string `json:"cron_expr"`
|
||||
MaxBackups int `json:"max_backups"`
|
||||
Status int8 `json:"status"`
|
||||
LastRunAt *string `json:"last_run_at"`
|
||||
NextRunAt *string `json:"next_run_at"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
// BackupLogVO 备份日志视图
|
||||
type BackupLogVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
PolicyID uint64 `json:"policy_id"`
|
||||
PolicyName string `json:"policy_name"`
|
||||
BackupType string `json:"backup_type"`
|
||||
Status string `json:"status"`
|
||||
FilePath string `json:"file_path"`
|
||||
FileSize int64 `json:"file_size"`
|
||||
DBSize int64 `json:"db_size"`
|
||||
FilesCount int `json:"files_count"`
|
||||
Duration int `json:"duration"`
|
||||
ErrorMsg string `json:"error_msg"`
|
||||
StartedAt string `json:"started_at"`
|
||||
FinishedAt *string `json:"finished_at"`
|
||||
}
|
||||
|
||||
// ========== 组织架构 ==========
|
||||
|
||||
// DeptCreateRequest 创建部门请求
|
||||
type DeptCreateRequest struct {
|
||||
Name string `json:"name" binding:"required,max=128"`
|
||||
Code string `json:"code" binding:"max=64"`
|
||||
ParentID uint64 `json:"parent_id"`
|
||||
LeaderID uint64 `json:"leader_id"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
}
|
||||
|
||||
// DeptUpdateRequest 更新部门请求
|
||||
type DeptUpdateRequest struct {
|
||||
Name string `json:"name" binding:"required,max=128"`
|
||||
Code string `json:"code"`
|
||||
LeaderID uint64 `json:"leader_id"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
Status *int8 `json:"status"`
|
||||
}
|
||||
|
||||
// DeptVO 部门视图对象
|
||||
type DeptVO struct {
|
||||
ID uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Code string `json:"code"`
|
||||
ParentID uint64 `json:"parent_id"`
|
||||
Path string `json:"path"`
|
||||
LeaderID uint64 `json:"leader_id"`
|
||||
SortOrder int `json:"sort_order"`
|
||||
Status int8 `json:"status"`
|
||||
Children []DeptVO `json:"children,omitempty"` // 子部门
|
||||
}
|
||||
Reference in New Issue
Block a user