List attachment original filter

This commit is contained in:
2024-08-11 16:21:16 +08:00
parent d34e6f068b
commit de6215cffe
2 changed files with 8 additions and 5 deletions

View File

@ -62,6 +62,10 @@ func listAttachment(c *fiber.Ctx) error {
tx = tx.Where("usage IN ?", strings.Split(usage, " "))
}
if original := c.QueryBool("original", false); original {
tx = tx.Where("ref_id IS NULL")
}
var count int64
countTx := tx
if err := countTx.Model(&models.Attachment{}).Count(&count).Error; err != nil {