fix updating collection.

This commit is contained in:
2025-07-31 16:39:25 +08:00
parent 619dc01bf4
commit 5ef6b091e8

View File

@@ -42,11 +42,11 @@ func UpdateCollection(id uint, title string, article string, images []uint) erro
Article: article, 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 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 return err
} }