Paperclip/pkg/internal/models/attachments.go

51 lines
1.3 KiB
Go
Raw Normal View History

2024-05-17 15:59:51 +08:00
package models
2024-08-18 12:01:41 +08:00
import (
2024-10-27 13:13:40 +08:00
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
2024-08-18 12:01:41 +08:00
"time"
2024-09-11 23:55:46 +08:00
"gorm.io/datatypes"
2024-08-18 12:01:41 +08:00
)
2024-05-17 15:59:51 +08:00
2024-07-28 21:03:56 +08:00
type AttachmentDst = int8
const (
AttachmentDstTemporary = AttachmentDst(iota)
AttachmentDstPermanent
)
2024-05-17 15:59:51 +08:00
type Attachment struct {
2024-10-27 13:13:40 +08:00
cruda.BaseModel
2024-05-17 15:59:51 +08:00
2024-08-18 14:09:52 +08:00
// Random ID is for accessing (appear in URL)
Rid string `json:"rid" gorm:"uniqueIndex"`
// Unique ID is for storing (appear in local file name or object name)
Uuid string `json:"uuid"`
2024-07-28 21:03:56 +08:00
Size int64 `json:"size"`
Name string `json:"name"`
Alternative string `json:"alt"`
MimeType string `json:"mimetype"`
HashCode string `json:"hash"`
Destination AttachmentDst `json:"destination"`
RefCount int `json:"ref_count"`
2024-05-17 15:59:51 +08:00
2024-08-20 17:08:40 +08:00
FileChunks datatypes.JSONMap `json:"file_chunks"`
2024-08-18 12:01:41 +08:00
CleanedAt *time.Time `json:"cleaned_at"`
2024-07-29 13:22:57 +08:00
Metadata datatypes.JSONMap `json:"metadata"`
IsMature bool `json:"is_mature"`
IsAnalyzed bool `json:"is_analyzed"`
2024-08-20 17:08:40 +08:00
IsUploaded bool `json:"is_uploaded"`
2024-08-11 01:08:08 +08:00
IsSelfRef bool `json:"is_self_ref"`
2024-05-17 15:59:51 +08:00
Ref *Attachment `json:"ref"`
RefID *uint `json:"ref_id"`
2024-08-18 12:01:41 +08:00
Pool *AttachmentPool `json:"pool"`
PoolID *uint `json:"pool_id"`
2024-11-03 01:53:57 +08:00
AccountID uint `json:"account_id"`
2024-05-17 15:59:51 +08:00
}