mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
Initial commit
This commit is contained in:
33
server/model/file.go
Normal file
33
server/model/file.go
Normal 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,
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user