68 lines
3.5 KiB
Go
68 lines
3.5 KiB
Go
package app
|
||
|
||
import (
|
||
"git.echol.cn/loser/st/server/global"
|
||
"gorm.io/datatypes"
|
||
)
|
||
|
||
// AIExtension 扩展(Extension)表
|
||
type AIExtension struct {
|
||
global.GVA_MODEL
|
||
UserID uint `json:"userId" gorm:"not null;index;comment:所属用户ID"`
|
||
User *AppUser `json:"user" gorm:"foreignKey:UserID"`
|
||
|
||
// 基础信息
|
||
Name string `json:"name" gorm:"type:varchar(200);not null;index;comment:扩展名称(唯一标识)"`
|
||
DisplayName string `json:"displayName" gorm:"type:varchar(200);comment:扩展显示名称"`
|
||
Version string `json:"version" gorm:"type:varchar(50);default:'1.0.0';comment:版本号"`
|
||
Author string `json:"author" gorm:"type:varchar(200);comment:作者"`
|
||
Description string `json:"description" gorm:"type:text;comment:扩展描述"`
|
||
Homepage string `json:"homepage" gorm:"type:varchar(500);comment:主页链接"`
|
||
Repository string `json:"repository" gorm:"type:varchar(500);comment:仓库地址"`
|
||
License string `json:"license" gorm:"type:varchar(100);comment:许可证"`
|
||
|
||
// 分类与标签
|
||
ExtensionType string `json:"extensionType" gorm:"type:varchar(20);default:'ui';comment:扩展类型:ui,server,hybrid"`
|
||
Category string `json:"category" gorm:"type:varchar(50);comment:分类:utilities,themes,integrations,tools"`
|
||
Tags datatypes.JSON `json:"tags" gorm:"type:jsonb;comment:标签列表"`
|
||
|
||
// 依赖管理
|
||
Dependencies datatypes.JSON `json:"dependencies" gorm:"type:jsonb;comment:依赖扩展"`
|
||
Conflicts datatypes.JSON `json:"conflicts" gorm:"type:jsonb;comment:冲突扩展"`
|
||
|
||
// 文件路径
|
||
ScriptPath string `json:"scriptPath" gorm:"type:varchar(500);comment:脚本文件路径"`
|
||
StylePath string `json:"stylePath" gorm:"type:varchar(500);comment:样式文件路径"`
|
||
AssetPaths datatypes.JSON `json:"assetPaths" gorm:"type:jsonb;comment:资源文件路径列表"`
|
||
|
||
// 配置与元数据
|
||
ManifestData datatypes.JSON `json:"manifestData" gorm:"type:jsonb;comment:manifest 元数据"`
|
||
Settings datatypes.JSON `json:"settings" gorm:"type:jsonb;comment:扩展配置"`
|
||
Options datatypes.JSON `json:"options" gorm:"type:jsonb;comment:扩展选项"`
|
||
Metadata datatypes.JSON `json:"metadata" gorm:"type:jsonb;comment:额外元数据"`
|
||
|
||
// 状态管理
|
||
IsEnabled bool `json:"isEnabled" gorm:"default:false;comment:是否启用"`
|
||
IsInstalled bool `json:"isInstalled" gorm:"default:true;comment:是否已安装"`
|
||
IsSystemExt bool `json:"isSystemExt" gorm:"default:false;comment:是否系统扩展"`
|
||
|
||
// 安装信息
|
||
InstallSource string `json:"installSource" gorm:"type:varchar(50);comment:安装来源:url,git,file,marketplace"`
|
||
SourceURL string `json:"sourceUrl" gorm:"type:varchar(500);comment:源地址"`
|
||
Branch string `json:"branch" gorm:"type:varchar(100);default:'main';comment:Git 分支"`
|
||
AutoUpdate bool `json:"autoUpdate" gorm:"default:false;comment:是否自动更新"`
|
||
LastUpdateCheck *int64 `json:"lastUpdateCheck" gorm:"comment:最后检查更新时间戳"`
|
||
AvailableVersion string `json:"availableVersion" gorm:"type:varchar(50);comment:可用的新版本"`
|
||
InstallDate *int64 `json:"installDate" gorm:"comment:安装日期时间戳"`
|
||
LastEnabled *int64 `json:"lastEnabled" gorm:"comment:最后启用时间戳"`
|
||
|
||
// 统计信息
|
||
UsageCount int `json:"usageCount" gorm:"default:0;comment:使用次数"`
|
||
ErrorCount int `json:"errorCount" gorm:"default:0;comment:错误次数"`
|
||
LoadTime int `json:"loadTime" gorm:"default:0;comment:加载时间(ms)"`
|
||
}
|
||
|
||
func (AIExtension) TableName() string {
|
||
return "ai_extensions"
|
||
}
|