feat: import services and standardize Go 1.26.5
This commit is contained in:
24
apps/base/cloud/internal/models/cloud_album.go
Normal file
24
apps/base/cloud/internal/models/cloud_album.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 相册模型
|
||||
type CloudAlbum struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
CloudBase
|
||||
Name string `gorm:"size:100" json:"name"` // 相册名称
|
||||
Description string `gorm:"size:500" json:"description"` // 相册描述
|
||||
CoverPhoto string `gorm:"size:255" json:"cover_photo"` // 封面照片URL
|
||||
IsPrivate bool `gorm:"default:false" json:"is_private"` // 是否私有
|
||||
|
||||
// 关联关系
|
||||
Photos []CloudPhoto `gorm:"foreignKey:AlbumID" json:"photos"` // 相册下的照片
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudAlbum{})
|
||||
}
|
||||
24
apps/base/cloud/internal/models/cloud_bookmark.go
Normal file
24
apps/base/cloud/internal/models/cloud_bookmark.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 网址收藏夹模型
|
||||
type CloudBookmark struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
CloudBase
|
||||
Title string `gorm:"size:200" json:"title"` // 标题
|
||||
URL string `gorm:"size:500" json:"url"` // 网址
|
||||
Description string `gorm:"size:500" json:"description"` // 描述
|
||||
Category string `gorm:"size:50" json:"category"` // 分类
|
||||
Tags string `gorm:"size:500" json:"tags"` // 标签
|
||||
Icon string `gorm:"size:500" json:"icon"` // 网站图标URL
|
||||
IsPrivate bool `gorm:"default:false" json:"is_private"` // 是否私有
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudBookmark{})
|
||||
}
|
||||
25
apps/base/cloud/internal/models/cloud_disk_dir.go
Normal file
25
apps/base/cloud/internal/models/cloud_disk_dir.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 云盘目录模型
|
||||
type CloudDiskDir struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
CloudBase
|
||||
ParentID *uint `gorm:"index" json:"parent_id"` // 支持嵌套目录
|
||||
Name string `gorm:"size:100" json:"name"` // 目录名称
|
||||
Path string `gorm:"size:500" json:"path"` // 完整路径
|
||||
|
||||
// 自关联
|
||||
Parent *CloudDiskDir `gorm:"foreignKey:ParentID" json:"parent"` // 父级目录
|
||||
Subdirectories []CloudDiskDir `gorm:"foreignKey:ParentID" json:"subdirectories"` // 子级目录
|
||||
Files []CloudDiskFile `gorm:"foreignKey:DirectoryID" json:"files"` // 文件
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudDiskDir{})
|
||||
}
|
||||
27
apps/base/cloud/internal/models/cloud_disk_file.go
Normal file
27
apps/base/cloud/internal/models/cloud_disk_file.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 云盘文件
|
||||
type CloudDiskFile struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
CloudBase
|
||||
DirectoryID *uint `gorm:"index" json:"directory_id"` // 文件所属目录
|
||||
Name string `gorm:"size:255" json:"name"` // 文件名
|
||||
OriginalName string `gorm:"size:255" json:"original_name"` // 原始文件名
|
||||
Size int64 `json:"size"` // 文件大小 (bytes)
|
||||
MimeType string `gorm:"size:100" json:"mime_type"` // 文件类型
|
||||
StoragePath string `gorm:"size:500" json:"storage_path"` // 实际存储路径
|
||||
Hash string `gorm:"size:64" json:"hash"` // 文件哈希,用于去重
|
||||
|
||||
// 关联关系
|
||||
Directory *CloudDiskDir `gorm:"foreignKey:DirectoryID" json:"dir"` // 文件所属目录
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudDiskFile{})
|
||||
}
|
||||
28
apps/base/cloud/internal/models/cloud_note.go
Normal file
28
apps/base/cloud/internal/models/cloud_note.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 知识笔记模型
|
||||
type CloudNote struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
CloudBase
|
||||
Title string `gorm:"size:200" json:"title"` // 标题
|
||||
Content string `gorm:"type:text" json:"content"` // 内容
|
||||
Category string `gorm:"size:50" json:"category"` // 分类
|
||||
Tags string `gorm:"size:500" json:"tags"` // 标签,逗号分隔
|
||||
IsMarkdown bool `gorm:"default:true" json:"is_markdown"` // 是否是markdown格式
|
||||
IsPinned bool `gorm:"default:false" json:"is_pinned"` // 是否是置顶
|
||||
IsPrivate bool `gorm:"default:false" json:"is_private"` // 是否是私有
|
||||
Views int `gorm:"default:0" json:"views"` // 浏览次数
|
||||
|
||||
// 关联关系
|
||||
Attachments []NoteAttachment `gorm:"foreignKey:NoteID" json:"attachments"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudNote{})
|
||||
}
|
||||
22
apps/base/cloud/internal/models/cloud_note_attach.go
Normal file
22
apps/base/cloud/internal/models/cloud_note_attach.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
)
|
||||
|
||||
// 笔记附件模型
|
||||
type NoteAttachment struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
NoteID uint `gorm:"index" json:"note_id"` // 笔记ID
|
||||
FileName string `gorm:"size:255" json:"file_name"` // 文件名
|
||||
FilePath string `gorm:"size:500" json:"file_path"` // 文件路径
|
||||
FileSize int64 `json:"file_size"` // 文件大小
|
||||
MimeType string `gorm:"size:100" json:"mime_type"` // 文件类型
|
||||
CreatedAt time.Time `json:"created_at"` // 创建时间
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&NoteAttachment{})
|
||||
}
|
||||
32
apps/base/cloud/internal/models/cloud_photo.go
Normal file
32
apps/base/cloud/internal/models/cloud_photo.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 照片模型
|
||||
type CloudPhoto struct {
|
||||
types.Std_IICUDS
|
||||
CloudBase
|
||||
AlbumID uint `gorm:"index" json:"album_id"` // 专辑ID
|
||||
Title string `gorm:"size:100" json:"title"` // 照片标题
|
||||
Description string `gorm:"size:500" json:"description"` // 照片描述
|
||||
FilePath string `gorm:"size:500" json:"file_path"` // 文件路径
|
||||
FileSize int64 `json:"file_size"` // 文件大小
|
||||
MimeType string `gorm:"size:100" json:"mime_type"` // 文件类型
|
||||
Width int `json:"width"` // 图片宽度
|
||||
Height int `json:"height"` // 图片高度
|
||||
TakenAt time.Time `json:"taken_at"` // 拍摄时间
|
||||
Location string `gorm:"size:200" json:"location"` // 拍摄地点
|
||||
Tags string `gorm:"size:500" json:"tags"` // 标签,逗号分隔
|
||||
|
||||
// 关联关系
|
||||
Album CloudAlbum `gorm:"foreignKey:AlbumID" json:"album"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudPhoto{})
|
||||
}
|
||||
23
apps/base/cloud/internal/models/cloud_private.go
Normal file
23
apps/base/cloud/internal/models/cloud_private.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 个人隐私数据模型
|
||||
type CloudPrivate struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
CloudBase
|
||||
DataType string `gorm:"size:50" json:"data_type"` // 数据类型: password, card, document, etc.
|
||||
Title string `gorm:"size:200" json:"title"` // 标题
|
||||
Description string `gorm:"size:500" json:"description"` // 描述
|
||||
Data string `gorm:"type:text" json:"data"` // 加密存储的实际数据
|
||||
IsEncrypted bool `gorm:"default:true" json:"is_encrypted"` // 是否已加密
|
||||
Tags string `gorm:"size:500" json:"tags"` // 标签
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudPrivate{})
|
||||
}
|
||||
27
apps/base/cloud/internal/models/cloud_share.go
Normal file
27
apps/base/cloud/internal/models/cloud_share.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 分享系统模型
|
||||
type CloudShare struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
CloudBase
|
||||
ShareType string `gorm:"size:20" json:"share_type"` // file, album, note, etc.
|
||||
ResourceID uint `json:"resource_id"` // 对应资源的ID
|
||||
ShareToken string `gorm:"uniqueIndex;size:32" json:"share_token"` // 分享令牌
|
||||
Password string `gorm:"size:100" json:"password"` // 可选分享密码
|
||||
ExpiresAt time.Time `json:"expires_at"` // 过期时间
|
||||
ViewCount int `gorm:"default:0" json:"view_count"` // 浏览次数
|
||||
DownloadCount int `gorm:"default:0" json:"download_count"` // 下载次数
|
||||
IsPublic bool `gorm:"default:false" json:"is_public"` // 是否公开
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudShare{})
|
||||
}
|
||||
33
apps/base/cloud/internal/models/cloud_space.go
Normal file
33
apps/base/cloud/internal/models/cloud_space.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/database"
|
||||
"git.apinb.com/bsm-sdk/engine/types"
|
||||
)
|
||||
|
||||
// 系统统计和配置模型
|
||||
type CloudSpace struct {
|
||||
types.Std_IICUDS
|
||||
types.Std_Passport
|
||||
KeyIdentifier string `gorm:"uniqueIndex;size:32" json:"key_identifier"`
|
||||
TotalStorage int64 `json:"total_storage"` // 总存储空间
|
||||
UsedStorage int64 `json:"used_storage"` // 已用存储空间
|
||||
MaxStorage int64 `json:"max_storage"` // 最大存储空间
|
||||
FileCount int `json:"file_count"` // 文件数量
|
||||
AlbumCount int `json:"album_count"` // 相册数量
|
||||
PhotoCount int `json:"photo_count"` // 照片数量
|
||||
NoteCount int `json:"note_count"` // 笔记数量
|
||||
BookmarkCount int `json:"bookmark_count"` // 书签数量
|
||||
PrivateCount int `json:"private_count"` // 私有数量
|
||||
|
||||
CloudDiskDirectorys []CloudDiskDir `gorm:"foreignKey:PassportID" json:"cloud_disk_dirs"` // 关联云盘目录
|
||||
Albums []CloudAlbum `gorm:"foreignKey:PassportID" json:"cloud_albums"` // 关联相册
|
||||
Notes []CloudNote `gorm:"foreignKey:PassportID" json:"cloud_notes"` // 关联笔记
|
||||
Bookmarks []CloudBookmark `gorm:"foreignKey:PassportID" json:"cloud_bookmarks"` // 关联书签
|
||||
PrivateData []CloudPrivate `gorm:"foreignKey:PassportID" json:"cloud_private"` // 关联私有数据
|
||||
Shares []CloudShare `gorm:"foreignKey:PassportID" json:"cloud_shares"` // 关联分享
|
||||
}
|
||||
|
||||
func init() {
|
||||
database.AppendMigrate(&CloudSpace{})
|
||||
}
|
||||
7
apps/base/cloud/internal/models/query.go
Normal file
7
apps/base/cloud/internal/models/query.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package models
|
||||
|
||||
// CloudBase 云盘基础信息
|
||||
type CloudBase struct {
|
||||
CloudID uint `gorm:"column:cloud_id;Index;" json:"cloud_id"` // 云盘ID
|
||||
CloudIdentity string `gorm:"column:cloud_identity;type:varchar(36);Index;" json:"cloud_identity"` // 云盘唯一标识,24位NanoID,36位为ULID
|
||||
}
|
||||
Reference in New Issue
Block a user