初始化

This commit is contained in:
2026-07-03 15:58:29 +08:00
parent 3a942c882e
commit dc90e889e1
77 changed files with 12912 additions and 0 deletions

23
server/model/folder.go Normal file
View File

@@ -0,0 +1,23 @@
package model
import "time"
// Folder 文件夹模型
// 使用物化路径(materialized path)实现树形结构
// 例如: /0/1/5/ 表示根目录下ID=1的文件夹中的ID=5的文件夹
type Folder struct {
ID uint64 `json:"id" gorm:"primaryKey;autoIncrement"`
Name string `json:"name" gorm:"size:256;not null"`
ParentID uint64 `json:"parent_id" gorm:"index;default:0"` // 0=根目录
OwnerID uint64 `json:"owner_id" gorm:"index;not null"`
Path string `json:"path" gorm:"size:1024;not null"` // 物化路径
Status int8 `json:"status" gorm:"default:1"` // 1=正常 0=回收站
Version int `json:"version" gorm:"default:1"` // 乐观锁版本号
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// TableName 指定表名
func (Folder) TableName() string {
return "fs_folder"
}