From cba9f19ba50c60576a5961e89c24caefca52d740 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 3 Sep 2023 23:39:05 +0530 Subject: deleting addresses upon customer deletion --- item/hooks.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'item/hooks.go') diff --git a/item/hooks.go b/item/hooks.go index c7dc498..74b6860 100644 --- a/item/hooks.go +++ b/item/hooks.go @@ -60,7 +60,10 @@ func (b *Brand) BeforeDelete(tx *gorm.DB) error { } // delete all items - db.Where("brand_id = ? and user_id = ?", b.ID, b.UserID).Delete(&SavedItem{}) + err := db.Where("brand_id = ? and user_id = ?", b.ID, b.UserID).Delete(&SavedItem{}).Error + if err != nil { + return err + } return nil } -- cgit v1.2.3