🐛 Fix where statement type error

This commit is contained in:
LittleSheep 2024-07-25 22:15:06 +08:00
parent 01e395b2bf
commit 0f1c787137

View File

@ -157,10 +157,7 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
}
var attachment models.Attachment
if err := database.C.Where(models.Attachment{
BaseModel: models.BaseModel{ID: uint(id)},
AccountID: user.ID,
}).First(&attachment).Error; err != nil {
if err := database.C.Where("id = ? AND account_id = ?", id, user.ID).First(&attachment).Error; err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}