Paperclip/pkg/internal/models/attachments.go

58 lines
1.7 KiB
Go
Raw 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/hypernet/nexus/pkg/nex/cruda"
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
const (
AttachmentDstTemporary = 0 // The destination 0 is a reserved config for pre-upload processing
2024-07-28 13:03:56 +00:00
)
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"`
Size int64 `json:"size"`
Name string `json:"name"`
Alternative string `json:"alt"`
MimeType string `json:"mimetype"`
HashCode string `json:"hash"`
Destination int `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"`
Metadata datatypes.JSONMap `json:"metadata"` // This field is analyzer auto generated metadata
Usermeta datatypes.JSONMap `json:"usermeta"` // This field is user set metadata
Thumbnail string `json:"thumbnail"` // The cover image of audio / video attachment
ContentRating int `json:"content_rating"` // This field use to filter mature content or not
QualityRating int `json:"quality_rating"` // This field use to filter good content or not
IsAnalyzed bool `json:"is_analyzed"`
IsUploaded bool `json:"is_uploaded"`
IsSelfRef bool `json:"is_self_ref"`
IsIndexable bool `json:"is_indexable"` // Show this attachment in the public directory api or not
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-11-02 17:53:57 +00:00
AccountID uint `json:"account_id"`
2024-12-26 14:41:11 +00:00
// Outdated fields, just for backward compatibility
IsMature bool `json:"is_mature"`
2024-05-17 07:59:51 +00:00
}