2024-05-17 07:59:51 +00:00
|
|
|
package models
|
|
|
|
|
2024-08-18 04:01:41 +00:00
|
|
|
import (
|
2024-10-27 05:13:40 +00:00
|
|
|
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
2024-08-18 04:01:41 +00:00
|
|
|
"time"
|
2024-09-11 15:55:46 +00:00
|
|
|
|
|
|
|
"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-10-27 05:13:40 +00:00
|
|
|
cruda.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"`
|
2024-07-28 16:01:51 +00:00
|
|
|
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
|
|
|
|
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
|
|
|
}
|