🐛 Fix is indexable query filter issue

This commit is contained in:
LittleSheep 2024-12-26 22:11:34 +08:00
parent 3a77af23cb
commit 243dbfa9c2

View File

@ -44,6 +44,8 @@ func listAttachment(c *fiber.Ctx) error {
tx = tx.Where("rid IN ?", pendingQueryId)
needQuery = len(pendingQueryId) > 0
} else {
tx = tx.Where("is_indexable IS NULL OR is_indexable = ?", true)
// Do sort this when doesn't filter by the id
// Because the sort will mess up the result
tx = tx.Order("created_at DESC")
@ -74,8 +76,6 @@ func listAttachment(c *fiber.Ctx) error {
tx = tx.Where("ref_id IS NULL")
}
tx = tx.Where("is_indexable != ?", false)
var count int64
countTx := tx
if err := countTx.Model(&models.Attachment{}).Count(&count).Error; err != nil {