🐛 Fix account_id where clause causing indexing issue

This commit is contained in:
2024-09-08 01:37:03 +08:00
parent 94f4519164
commit 42fedd7745
3 changed files with 9 additions and 4 deletions

View File

@ -57,7 +57,8 @@ func listAttachment(c *fiber.Ctx) error {
if err := database.C.Where("name = ?", c.Query("author")).First(&author).Error; err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else {
tx = tx.Where("account_id = ?", author.ID)
prefix := viper.GetString("database.prefix")
tx = tx.Where(fmt.Sprintf("%sattachments.account_id = ?", prefix), author.ID)
}
}