package models import "time" // 通用请求和响应结构 // ErrorResponse 错误响应 type ErrorResponse struct { Error string `json:"error"` Message string `json:"message"` } // SuccessResponse 成功响应 type SuccessResponse struct { Message string `json:"message"` } // BatchDeleteRequest 批量删除请求 type BatchDeleteRequest struct { IDs []uint `json:"ids" binding:"required,min=1"` } // GenerateSlugRequest 生成slug请求 type GenerateSlugRequest struct { Name string `json:"name" binding:"required"` } // GenerateSlugResponse 生成slug响应 type GenerateSlugResponse struct { Slug string `json:"slug"` } // 照片相关请求 // CreatePhotoRequest 创建照片请求 type CreatePhotoRequest struct { Title string `json:"title" binding:"required"` Description string `json:"description"` OriginalFilename string `json:"original_filename"` FileSize int64 `json:"file_size"` Status string `json:"status" binding:"oneof=draft published archived processing"` CategoryIDs []uint `json:"category_ids"` TagIDs []uint `json:"tag_ids"` Camera string `json:"camera"` Lens string `json:"lens"` ISO int `json:"iso"` Aperture string `json:"aperture"` ShutterSpeed string `json:"shutter_speed"` FocalLength string `json:"focal_length"` TakenAt *time.Time `json:"taken_at"` } // UpdatePhotoRequest 更新照片请求 type UpdatePhotoRequest struct { Title *string `json:"title"` Description *string `json:"description"` Status *string `json:"status" binding:"omitempty,oneof=draft published archived processing"` CategoryIDs *[]uint `json:"category_ids"` TagIDs *[]uint `json:"tag_ids"` Camera *string `json:"camera"` Lens *string `json:"lens"` ISO *int `json:"iso"` Aperture *string `json:"aperture"` ShutterSpeed *string `json:"shutter_speed"` FocalLength *string `json:"focal_length"` TakenAt *time.Time `json:"taken_at"` } // BatchUpdatePhotosRequest 批量更新照片请求 type BatchUpdatePhotosRequest struct { IDs []uint `json:"ids" binding:"required,min=1"` Status *string `json:"status" binding:"omitempty,oneof=draft published archived processing"` CategoryIDs *[]uint `json:"category_ids"` TagIDs *[]uint `json:"tag_ids"` } // PhotoStats 照片统计信息 type PhotoStats struct { Total int64 `json:"total"` ThisMonth int64 `json:"this_month"` Today int64 `json:"today"` TotalSize int64 `json:"total_size"` StatusStats map[string]int64 `json:"status_stats"` } // 分类相关请求 // CreateCategoryRequest 创建分类请求 type CreateCategoryRequest struct { Name string `json:"name" binding:"required"` Slug string `json:"slug" binding:"required"` Description string `json:"description"` ParentID *uint `json:"parent_id"` } // UpdateCategoryRequest 更新分类请求 type UpdateCategoryRequest struct { Name *string `json:"name"` Slug *string `json:"slug"` Description *string `json:"description"` ParentID *uint `json:"parent_id"` SortOrder *int `json:"sort_order"` IsActive *bool `json:"is_active"` } // ReorderCategoriesRequest 重新排序分类请求 type ReorderCategoriesRequest struct { ParentID *uint `json:"parent_id"` CategoryIDs []uint `json:"category_ids" binding:"required,min=1"` } // CategoryStats 分类统计信息 type CategoryStats struct { Total int64 `json:"total"` Active int64 `json:"active"` TopLevel int64 `json:"top_level"` PhotoCounts map[string]int64 `json:"photo_counts"` } // CategoryTree 分类树结构 type CategoryTree struct { ID uint `json:"id"` Name string `json:"name"` Slug string `json:"slug"` Description string `json:"description"` ParentID *uint `json:"parent_id"` SortOrder int `json:"sort_order"` IsActive bool `json:"is_active"` PhotoCount int64 `json:"photo_count"` Children []CategoryTree `json:"children"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // 标签相关请求 // CreateTagRequest 创建标签请求 type CreateTagRequest struct { Name string `json:"name" binding:"required"` Slug string `json:"slug" binding:"required"` Description string `json:"description"` Color string `json:"color"` } // UpdateTagRequest 更新标签请求 type UpdateTagRequest struct { Name *string `json:"name"` Slug *string `json:"slug"` Description *string `json:"description"` Color *string `json:"color"` IsActive *bool `json:"is_active"` } // TagStats 标签统计信息 type TagStats struct { Total int64 `json:"total"` Active int64 `json:"active"` Used int64 `json:"used"` Unused int64 `json:"unused"` AvgPhotosPerTag float64 `json:"avg_photos_per_tag"` } // TagWithCount 带照片数量的标签 type TagWithCount struct { Tag PhotoCount int64 `json:"photo_count"` } // TagCloudItem 标签云项目 type TagCloudItem struct { Name string `json:"name"` Slug string `json:"slug"` Color string `json:"color"` Count int64 `json:"count"` } // 用户相关请求 // CreateUserRequest 创建用户请求 type CreateUserRequest struct { Username string `json:"username" binding:"required,min=3,max=50"` Email string `json:"email" binding:"required,email"` Password string `json:"password" binding:"required,min=8"` Role string `json:"role" binding:"oneof=user editor admin"` } // UpdateUserRequest 更新用户请求 type UpdateUserRequest struct { Username *string `json:"username" binding:"omitempty,min=3,max=50"` Email *string `json:"email" binding:"omitempty,email"` Role *string `json:"role" binding:"omitempty,oneof=user editor admin"` IsActive *bool `json:"is_active"` } // UpdateCurrentUserRequest 更新当前用户请求 type UpdateCurrentUserRequest struct { Username *string `json:"username" binding:"omitempty,min=3,max=50"` Email *string `json:"email" binding:"omitempty,email"` } // ChangePasswordRequest 修改密码请求 type ChangePasswordRequest struct { OldPassword string `json:"old_password" binding:"required"` NewPassword string `json:"new_password" binding:"required,min=8"` } // LoginRequest 登录请求 type LoginRequest struct { Username string `json:"username" binding:"required"` Password string `json:"password" binding:"required"` } // LoginResponse 登录响应 type LoginResponse struct { User *UserResponse `json:"user"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresIn int64 `json:"expires_in"` } // RefreshTokenRequest 刷新token请求 type RefreshTokenRequest struct { RefreshToken string `json:"refresh_token" binding:"required"` } // RefreshTokenResponse 刷新token响应 type RefreshTokenResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresIn int64 `json:"expires_in"` } // UserResponse 用户响应(隐藏敏感信息) type UserResponse struct { ID uint `json:"id"` Username string `json:"username"` Email string `json:"email"` Role string `json:"role"` IsActive bool `json:"is_active"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }