2024-05-17 07:59:51 +00:00
|
|
|
package models
|
|
|
|
|
2024-08-18 04:01:41 +00:00
|
|
|
import (
|
|
|
|
"gorm.io/datatypes"
|
|
|
|
"time"
|
|
|
|
)
|
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 {
|
|
|
|
BaseModel
|
|
|
|
|
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"`
|
2024-07-28 16:01:51 +00:00
|
|
|
RefCount int `json:"ref_count"`
|
2024-05-17 07:59:51 +00:00
|
|
|
|
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-10 17:08:08 +00:00
|
|
|
IsSelfRef bool `json:"is_self_ref"`
|
2024-05-17 07:59:51 +00:00
|
|
|
|
2024-07-28 16:01: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
|
|
|
}
|