Initial commit

This commit is contained in:
2025-05-11 20:32:14 +08:00
commit d97247159f
80 changed files with 13013 additions and 0 deletions

33
server/model/file.go Normal file
View File

@@ -0,0 +1,33 @@
package model
import (
"gorm.io/gorm"
)
type File struct {
gorm.Model
Filename string
Description string
StorageKey string
StorageID *uint `gorm:"default:null"`
Storage Storage
ResourceID uint
RedirectUrl string
Resource Resource `gorm:"foreignKey:ResourceID"`
UserID uint
User User `gorm:"foreignKey:UserID"`
}
type FileView struct {
ID uint `json:"id"`
Filename string `json:"filename"`
Description string `json:"description"`
}
func (f *File) ToView() *FileView {
return &FileView{
ID: f.ID,
Filename: f.Filename,
Description: f.Description,
}
}