Paperclip/pkg/internal/models/attachments.go

52 lines
1.3 KiB
Go
Raw Permalink Normal View History

2024-05-17 07:59:51 +00:00
package models
2024-08-18 04:01:41 +00:00
import (
"time"
2024-09-11 15:55:46 +00:00
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"gorm.io/datatypes"
2024-08-18 04:01:41 +00:00
)
2024-05-17 07:59:51 +00:00
2024-07-28 13:03:56 +00:00
type AttachmentDst = int8
const (
AttachmentDstTemporary = AttachmentDst(iota)
AttachmentDstPermanent
)
2024-05-17 07:59:51 +00:00
type Attachment struct {
2024-09-11 15:55:46 +00:00
hyper.BaseModel
2024-05-17 07:59:51 +00:00
2024-08-18 06:09:52 +00: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 13:03:56 +00: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 07:59:51 +00:00
2024-08-20 09:08:40 +00:00
FileChunks datatypes.JSONMap `json:"file_chunks"`
2024-08-18 04:01:41 +00:00
CleanedAt *time.Time `json:"cleaned_at"`
2024-07-29 05:22:57 +00:00
Metadata datatypes.JSONMap `json:"metadata"`
IsMature bool `json:"is_mature"`
IsAnalyzed bool `json:"is_analyzed"`
2024-08-20 09:08:40 +00:00
IsUploaded bool `json:"is_uploaded"`
2024-08-10 17:08:08 +00:00
IsSelfRef bool `json:"is_self_ref"`
2024-05-17 07:59:51 +00:00
Ref *Attachment `json:"ref"`
RefID *uint `json:"ref_id"`
2024-08-18 04:01:41 +00:00
Pool *AttachmentPool `json:"pool"`
PoolID *uint `json:"pool_id"`
2024-07-28 13:03:56 +00:00
Account Account `json:"account"`
AccountID uint `json:"account_id"`
2024-05-17 07:59:51 +00:00
}