Listing attachment will preload account

This commit is contained in:
LittleSheep 2024-07-27 00:23:22 +08:00
parent f5732726ed
commit 36d13f4b81

View File

@ -37,7 +37,7 @@ func listAttachment(c *fiber.Ctx) error {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}
var attachments []models.Attachment
if err := tx.Offset(offset).Limit(take).Find(&attachments).Error; err != nil {
if err := tx.Offset(offset).Limit(take).Preload("Account").Find(&attachments).Error; err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}