🐛 Fix analyzer did not clear cache

This commit is contained in:
LittleSheep 2025-04-05 11:38:12 +08:00
parent 11d54c7c78
commit 048535d1c0
4 changed files with 12 additions and 12 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/keys
.DS_Store
.idea

View File

@ -63,6 +63,7 @@ type Attachment struct {
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,

View File

@ -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"
)

View File

@ -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"