Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct {
BaseModel
Name string `gorm:"size:100;not null" json:"name"`
Description string `gorm:"size:500" json:"description"`
UserID uint `gorm:"not null;index" json:"user_id"`
User User `gorm:"foreignKey:UserID" json:"user"`
CoverImage string `gorm:"size:500" json:"cover_image"`
ImageCount int `gorm:"default:0" json:"image_count"`
Images []Image `gorm:"many2many:image_albums;" json:"images"`
GalleryEnabled bool `gorm:"default:false" json:"gallery_enabled"`
SerialNumber int `gorm:"default:0" json:"serial_number"`
}
type BackupTask ¶
type BackupTask struct {
BaseModel
Status string `gorm:"size:20;not null" json:"status"`
StartTime time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time"`
Size int64 `json:"size"`
StoragePath string `gorm:"size:255" json:"storage_path"`
Error string `gorm:"type:text" json:"error"`
}
func (BackupTask) TableName ¶
func (BackupTask) TableName() string
type GalleryConfig ¶
type GeneralConfig ¶
type GeneralConfig struct {
MaxThumbSize uint `mapstructure:"max_thumb_size"`
RegisterEnabled bool `mapstructure:"register_enabled"`
MaxTags int `mapstructure:"max_tags"`
}
GeneralConfig 通用配置结构体
type Image ¶
type Image struct {
BaseModel
FileName string `gorm:"size:255;not null" json:"file_name"`
OriginalName string `gorm:"size:255;not null" json:"original_name"`
FileURL string `gorm:"size:500;not null;uniqueIndex" json:"file_url"`
FileSize int64 `gorm:"not null" json:"file_size"`
Width int `gorm:"not null" json:"width"`
Height int `gorm:"not null" json:"height"`
MimeType string `gorm:"size:50;not null" json:"mime_type"`
UserID uint `gorm:"not null;index" json:"user_id"`
User User `gorm:"foreignKey:UserID" json:"user"`
Albums []Album `gorm:"many2many:image_albums;" json:"albums"`
ThumbnailURL string `gorm:"size:500" json:"thumbnail_url"`
ThumbnailSize int64 `gorm:"not null" json:"thumbnail_size"`
ThumbnailWidth int `gorm:"not null" json:"thumbnail_width"`
ThumbnailHeight int `gorm:"not null" json:"thumbnail_height"`
Tags []string `gorm:"type:json;serializer:json;" json:"tags"`
StorageName string `gorm:"size:50;not null;default:'local'" json:"storage_name"` // 存储配置名称
}
type ImageAlbum ¶
type ImageAlbum struct {
ImageID uint `gorm:"primaryKey" json:"image_id"`
AlbumID uint `gorm:"primaryKey" json:"album_id"`
Image Image `gorm:"foreignKey:ImageID" json:"image"`
Album Album `gorm:"foreignKey:AlbumID" json:"album"`
}
func (ImageAlbum) TableName ¶
func (ImageAlbum) TableName() string
type MailConfig ¶
type MailConfig struct {
Enabled bool `mapstructure:"enabled"`
ServerAddress string `mapstructure:"server_address"`
SMTP SMTPConfig `mapstructure:"smtp"`
}
MailConfig 邮件配置结构体
type PasswordResetCode ¶
type PasswordResetCode struct {
BaseModel
Email string `gorm:"size:100;not null;index" json:"email"`
Code string `gorm:"size:6;not null" json:"code"`
ExpiresAt time.Time `gorm:"not null" json:"expires_at"`
Used bool `gorm:"default:false" json:"used"`
}
func (PasswordResetCode) TableName ¶
func (PasswordResetCode) TableName() string
type RefreshTokenBlacklist ¶
type RefreshTokenBlacklist struct {
ID uint `gorm:"primaryKey" json:"id"`
TokenHash string `gorm:"uniqueIndex;size:64;not null" json:"token_hash"`
ExpiresAt time.Time `gorm:"index;not null" json:"expires_at"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
}
func (RefreshTokenBlacklist) TableName ¶
func (RefreshTokenBlacklist) TableName() string
type RestoreTask ¶
type RestoreTask struct {
BaseModel
BackupTask BackupTask `gorm:"foreignKey:BackupTaskID" json:"backup_task"`
BackupTaskID uint `json:"backup_task_id"`
Status string `gorm:"size:20;not null" json:"status"`
StartTime time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time"`
Error string `gorm:"type:text" json:"error"`
}
func (RestoreTask) TableName ¶
func (RestoreTask) TableName() string
type Role ¶
type Role struct {
BaseModel
Name string `gorm:"uniqueIndex;size:50;not null" json:"name"`
Description string `gorm:"size:200" json:"description"`
Users []User `gorm:"foreignKey:RoleID" json:"users"`
AllowedExtensions []string `gorm:"type:json;serializer:json;" json:"allowed_extensions"`
MaxFilesPerUpload int `gorm:"default:10" json:"max_files_per_upload"`
MaxFileSizeMB int `gorm:"default:5" json:"max_file_size_mb"`
MaxAlbumsPerUser int `gorm:"default:5" json:"max_albums_per_user"`
MaxStorageSizeMB int `gorm:"default:300" json:"max_storage_size_mb"`
GalleryOpen bool `gorm:"default:false" json:"gallery_open"`
StorageName string `gorm:"size:50;default:'local'" json:"storage_name"` // 存储配置名称
}
Role -1表示无限制
type SMTPConfig ¶
type SMTPConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
From string `mapstructure:"from"`
FromName string `mapstructure:"from_name"`
}
SMTPConfig SMTP配置结构体
type Storage ¶
type Storage struct {
BaseModel
Name string `gorm:"uniqueIndex;size:50;not null" json:"name"`
Type string `gorm:"size:20;not null" json:"type"` // local, webdav
Config StorageConfig `gorm:"type:json;serializer:json;not null" json:"config"`
}
Storage 存储配置模型
type StorageConfig ¶
type StorageConfig struct {
// 通用配置
BasePath string `json:"base_path"`
StaticURL string `json:"static_url"`
// WebDAV 特定配置
BaseURL string `json:"base_url"`
Username string `json:"username"`
Password string `json:"password"`
}
StorageConfig 存储配置结构
type SystemSetting ¶
type SystemSetting struct {
BaseModel
Value SystemSettings `gorm:"type:json;serializer:json" json:"value"`
}
SystemSetting 系统设置模型
type SystemSettings ¶
type SystemSettings struct {
General GeneralConfig `mapstructure:"general"`
Mail MailConfig `mapstructure:"mail"`
Gallery GalleryConfig `mapstructure:"gallery"`
}
SystemSettings 系统设置结构体
type User ¶
type User struct {
BaseModel
Username string `gorm:"uniqueIndex;size:50;not null" json:"username"`
Password string `gorm:"size:100;not null" json:"-"`
Email string `gorm:"uniqueIndex;size:100;not null" json:"email"`
RoleID uint `gorm:"not null;default:2" json:"role_id"`
Role Role `gorm:"foreignKey:RoleID" json:"role"`
Active bool `gorm:"default:false" json:"active"`
TotalSize int64 `gorm:"not null;default:0" json:"total_size"`
ImageCount int `gorm:"not null;default:0" json:"image_count"`
}
Click to show internal directories.
Click to hide internal directories.