test(05-04): add failing tests for attach File, Thumb, and bucket
- ThumbFilename/PartitionDirectory/File.Thumb behavior tests - OpenBucket fail-loud and memblob tests - Migrate empty plugin list must create system_files
This commit is contained in:
48
lagoon/attach/file.go
Normal file
48
lagoon/attach/file.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package attach
|
||||
|
||||
import "time"
|
||||
|
||||
// Owner is implemented by models that own system_files rows. MorphName
|
||||
// must return the PHP class string so cutover-copied attachment_type
|
||||
// values keep matching.
|
||||
type Owner interface {
|
||||
MorphName() string
|
||||
}
|
||||
|
||||
// File is Winter's system_files row. AttachmentID is a string because
|
||||
// Winter stores the morph FK as a string, never an integer.
|
||||
type File struct {
|
||||
ID uint `gorm:"column:id;primaryKey"`
|
||||
DiskName string `gorm:"column:disk_name"`
|
||||
FileName string `gorm:"column:file_name"`
|
||||
FileSize int64 `gorm:"column:file_size"`
|
||||
ContentType string `gorm:"column:content_type"`
|
||||
Title *string `gorm:"column:title"`
|
||||
Description *string `gorm:"column:description"`
|
||||
Field string `gorm:"column:field"`
|
||||
AttachmentID string `gorm:"column:attachment_id"`
|
||||
AttachmentType string `gorm:"column:attachment_type"`
|
||||
IsPublic bool `gorm:"column:is_public"`
|
||||
SortOrder int `gorm:"column:sort_order"`
|
||||
Metadata *string `gorm:"column:metadata"`
|
||||
CreatedAt time.Time `gorm:"column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at"`
|
||||
}
|
||||
|
||||
func (File) TableName() string { return "system_files" }
|
||||
|
||||
var all []any
|
||||
|
||||
// Register appends models so schema tooling can see File without a plugin registry.
|
||||
func Register(models ...any) {
|
||||
all = append(all, models...)
|
||||
}
|
||||
|
||||
// All returns every model registered in this package.
|
||||
func All() []any {
|
||||
return all
|
||||
}
|
||||
|
||||
func init() {
|
||||
Register(&File{})
|
||||
}
|
||||
Reference in New Issue
Block a user