2023-08-07 03:32:46 +08:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
2024-08-03 03:06:14 +08:00
|
|
|
"database/sql"
|
2023-08-07 03:32:46 +08:00
|
|
|
"time"
|
2024-06-04 16:46:03 +08:00
|
|
|
|
2024-12-31 03:19:28 +08:00
|
|
|
"github.com/tgdrive/teldrive/internal/api"
|
2024-06-04 16:46:03 +08:00
|
|
|
"gorm.io/datatypes"
|
2023-08-07 03:32:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
type File struct {
|
2024-12-31 03:19:28 +08:00
|
|
|
Id string `gorm:"type:uuid;primaryKey;default:uuid7()"`
|
|
|
|
Name string `gorm:"type:text;not null"`
|
|
|
|
Type string `gorm:"type:text;not null"`
|
|
|
|
MimeType string `gorm:"type:text;not null"`
|
|
|
|
Size *int64 `gorm:"type:bigint"`
|
|
|
|
Category string `gorm:"type:text"`
|
|
|
|
Encrypted bool `gorm:"default:false"`
|
|
|
|
UserID int64 `gorm:"type:bigint;not null"`
|
|
|
|
Status string `gorm:"type:text"`
|
|
|
|
ParentID sql.NullString `gorm:"type:uuid;index"`
|
|
|
|
Parts datatypes.JSONSlice[api.Part] `gorm:"type:jsonb"`
|
|
|
|
ChannelID *int64 `gorm:"type:bigint"`
|
2025-01-10 19:49:30 +08:00
|
|
|
CreatedAt time.Time `gorm:"default:timezone('utc'::text, now())"`
|
2025-01-08 17:01:52 +08:00
|
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime:false"`
|
2023-08-07 03:32:46 +08:00
|
|
|
}
|