Boost CRUD API

This commit is contained in:
2024-12-28 21:41:13 +08:00
parent edbe412f97
commit d59966a03e
11 changed files with 299 additions and 22 deletions

View File

@ -35,8 +35,6 @@ type Attachment struct {
RefCount int `json:"ref_count"`
Type uint `json:"type"`
FileChunks datatypes.JSONMap `json:"file_chunks"`
CleanedAt *time.Time `json:"cleaned_at"`
Metadata datatypes.JSONMap `json:"metadata"` // This field is analyzer auto generated metadata
@ -62,11 +60,14 @@ type Attachment struct {
Pool *AttachmentPool `json:"pool"`
PoolID *uint `json:"pool_id"`
Boosts []AttachmentBoost `json:"boosts"`
AccountID uint `json:"account_id"`
// Outdated fields, just for backward compatibility
IsUploaded bool `json:"is_uploaded" gorm:"-"`
IsMature bool `json:"is_mature" gorm:"-"`
FileChunks datatypes.JSONMap `json:"file_chunks" gorm:"-"`
IsUploaded bool `json:"is_uploaded" gorm:"-"`
IsMature bool `json:"is_mature" gorm:"-"`
}
// Data model for in progress multipart attachments

View File

@ -0,0 +1,24 @@
package models
import "git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
const (
BoostStatusPending = iota
BoostStatusActive
BoostStatusSuspended
BoostStatusError
)
// AttachmentBoost is made for speed up attachment loading by copy the original attachments
// to others faster CDN or storage destinations.
type AttachmentBoost struct {
cruda.BaseModel
Status int `json:"status"`
Destination int `json:"destination"`
AttachmentID uint `json:"attachment_id"`
Attachment Attachment `json:"attachment"`
AccountID uint `json:"account"`
}