diff --git a/.gitignore b/.gitignore index cd42558..b13ba4f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /keys .DS_Store +.idea \ No newline at end of file diff --git a/pkg/filekit/models/attachments.go b/pkg/filekit/models/attachments.go index fcca0d1..d42ba17 100644 --- a/pkg/filekit/models/attachments.go +++ b/pkg/filekit/models/attachments.go @@ -61,8 +61,9 @@ type Attachment struct { Compressed *Attachment `json:"compressed"` CompressedID *uint `json:"compressed_id"` - Ref *Attachment `json:"ref"` - RefID *uint `json:"ref_id"` + Ref *Attachment `json:"ref"` + RefID *uint `json:"ref_id"` + RefURL *string `json:"ref_url"` // External URL for the attachment Pool *AttachmentPool `json:"pool"` PoolID *uint `json:"pool_id"` @@ -71,15 +72,13 @@ type Attachment struct { AccountID uint `json:"account_id"` Account models.Account `gorm:"-" json:"account"` - - // Outdated fields, just for backward compatibility - FileChunks datatypes.JSONMap `json:"file_chunks" gorm:"-"` - IsUploaded bool `json:"is_uploaded" gorm:"-"` - IsMature bool `json:"is_mature" gorm:"-"` } func (v *Attachment) AfterUpdate(tx *gorm.DB) error { - cachekit.FKey(cachekit.DAAttachment, v.Rid) + _ = cachekit.Delete( + gap.Ca, + cachekit.FKey(cachekit.DAAttachment, v.Rid), + ) return nil } @@ -114,7 +113,7 @@ type AttachmentFragment struct { } func (v *AttachmentFragment) AfterUpdate(tx *gorm.DB) error { - cachekit.Delete( + _ = cachekit.Delete( gap.Ca, cachekit.FKey("attachment-fragment", v.Rid), ) @@ -122,7 +121,7 @@ func (v *AttachmentFragment) AfterUpdate(tx *gorm.DB) error { return nil } -func (v AttachmentFragment) ToAttachment() Attachment { +func (v *AttachmentFragment) ToAttachment() Attachment { return Attachment{ Rid: v.Rid, Uuid: v.Uuid, diff --git a/pkg/internal/fs/merger.go b/pkg/internal/fs/merger.go index 4071187..d40a89d 100644 --- a/pkg/internal/fs/merger.go +++ b/pkg/internal/fs/merger.go @@ -6,8 +6,8 @@ import ( "os" "path/filepath" - "git.solsynth.dev/hypernet/paperclip/pkg/internal/database" "git.solsynth.dev/hypernet/paperclip/pkg/filekit/models" + "git.solsynth.dev/hypernet/paperclip/pkg/internal/database" "github.com/spf13/viper" ) diff --git a/pkg/internal/services/analyzer.go b/pkg/internal/services/analyzer.go index 80674b0..9bb770e 100644 --- a/pkg/internal/services/analyzer.go +++ b/pkg/internal/services/analyzer.go @@ -16,9 +16,9 @@ import ( "github.com/barasher/go-exiftool" "github.com/samber/lo" + "git.solsynth.dev/hypernet/paperclip/pkg/filekit/models" "git.solsynth.dev/hypernet/paperclip/pkg/internal/database" "git.solsynth.dev/hypernet/paperclip/pkg/internal/fs" - "git.solsynth.dev/hypernet/paperclip/pkg/filekit/models" jsoniter "github.com/json-iterator/go" "github.com/k0kubun/go-ansi" "github.com/kettek/apng"