29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
package models
|
|
|
|
import "gorm.io/gorm"
|
|
|
|
type AppFileType string
|
|
|
|
const (
|
|
AppFileTypeLessonPlan AppFileType = "lesson_plan"
|
|
)
|
|
|
|
type AppFile struct {
|
|
gorm.Model
|
|
FileType AppFileType `gorm:"type:varchar(64);not null;index" json:"fileType"`
|
|
OriginalFilename string `gorm:"size:255;not null" json:"originalFilename"`
|
|
StoredFilename string `gorm:"size:255;not null;uniqueIndex" json:"storedFilename"`
|
|
FilePath string `gorm:"size:1024;not null" json:"filePath"`
|
|
ContentType string `gorm:"size:255;not null" json:"contentType"`
|
|
FileSize int64 `gorm:"not null" json:"fileSize"`
|
|
MD5 string `gorm:"size:32;not null;uniqueIndex" json:"md5"`
|
|
UploaderID uint `gorm:"not null;index" json:"uploaderId"`
|
|
UploaderName string `gorm:"size:255;not null;index" json:"uploaderName"`
|
|
DownloadCount int64 `gorm:"not null;default:0" json:"downloadCount"`
|
|
LastDownloadAt *int64 `gorm:"type:bigint;index" json:"lastDownloadAt"`
|
|
}
|
|
|
|
func (AppFile) TableName() string {
|
|
return "app_files"
|
|
}
|