feat(category): Ensure all fields, including zero values, are updated in the Update method
Deploy Application / deploy (push) Successful in 23s
Details
Deploy Application / deploy (push) Successful in 23s
Details
This commit is contained in:
parent
b6c0509888
commit
47f5198326
|
|
@ -66,6 +66,7 @@ func (r *categoryRepository) Update(ctx context.Context, tx *gorm.DB, category e
|
||||||
if err := tx.WithContext(ctx).
|
if err := tx.WithContext(ctx).
|
||||||
Model(&entities.MCategoryEntity{}).
|
Model(&entities.MCategoryEntity{}).
|
||||||
Where("id = ?", category.ID).
|
Where("id = ?", category.ID).
|
||||||
|
Select("*"). // ← ini wajib agar semua field termasuk zero value diupdate
|
||||||
Updates(category).Error; err != nil {
|
Updates(category).Error; err != nil {
|
||||||
return category, err
|
return category, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue