Add cache into metadata fetching

This commit is contained in:
2024-06-29 21:16:11 +08:00
parent 55491ea3c9
commit e3eaa5ba20
4 changed files with 64 additions and 36 deletions

View File

@ -159,11 +159,11 @@ func updateAttachmentMeta(c *fiber.Ctx) error {
attachment.Metadata = data.Metadata
attachment.IsMature = data.IsMature
if err := database.C.Save(&attachment).Error; err != nil {
if attachment, err := services.UpdateAttachment(attachment); err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else {
return c.JSON(attachment)
}
return c.JSON(attachment)
}
func deleteAttachment(c *fiber.Ctx) error {