From 5ef6b091e8746c292a7d8173270e04da58839a81 Mon Sep 17 00:00:00 2001 From: nyne Date: Thu, 31 Jul 2025 16:39:25 +0800 Subject: [PATCH] fix updating collection. --- server/dao/collection.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/dao/collection.go b/server/dao/collection.go index 46a346b..ecfb9e0 100644 --- a/server/dao/collection.go +++ b/server/dao/collection.go @@ -42,11 +42,11 @@ func UpdateCollection(id uint, title string, article string, images []uint) erro Article: article, } - if err := tx.Model(collection).Where("id = ?", id).Updates(collection).Error; err != nil { + if err := tx.Model(collection).Updates(collection).Error; err != nil { return err } - if err := tx.Model(collection).Where("id = ?", id).Association("Images").Replace(images); err != nil { + if err := tx.Model(collection).Association("Images").Replace(images); err != nil { return err }