🐛 Fix is indexable query filter issue
This commit is contained in:
		| @@ -44,6 +44,8 @@ func listAttachment(c *fiber.Ctx) error { | |||||||
| 		tx = tx.Where("rid IN ?", pendingQueryId) | 		tx = tx.Where("rid IN ?", pendingQueryId) | ||||||
| 		needQuery = len(pendingQueryId) > 0 | 		needQuery = len(pendingQueryId) > 0 | ||||||
| 	} else { | 	} else { | ||||||
|  | 		tx = tx.Where("is_indexable IS NULL OR is_indexable = ?", true) | ||||||
|  |  | ||||||
| 		// Do sort this when doesn't filter by the id | 		// Do sort this when doesn't filter by the id | ||||||
| 		// Because the sort will mess up the result | 		// Because the sort will mess up the result | ||||||
| 		tx = tx.Order("created_at DESC") | 		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("ref_id IS NULL") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	tx = tx.Where("is_indexable != ?", false) |  | ||||||
|  |  | ||||||
| 	var count int64 | 	var count int64 | ||||||
| 	countTx := tx | 	countTx := tx | ||||||
| 	if err := countTx.Model(&models.Attachment{}).Count(&count).Error; err != nil { | 	if err := countTx.Model(&models.Attachment{}).Count(&count).Error; err != nil { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user