aboutsummaryrefslogtreecommitdiff
path: root/item/hooks.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2023-09-03 23:39:05 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2023-09-03 23:39:05 +0530
commitcba9f19ba50c60576a5961e89c24caefca52d740 (patch)
tree5dd36d4903c640e11a022c5fbf0e55adc3cdd5a5 /item/hooks.go
parent46083ff15e16b0b49132af9466bcab7c2ae71322 (diff)
deleting addresses upon customer deletionv0.0.5
Diffstat (limited to 'item/hooks.go')
-rw-r--r--item/hooks.go5
1 files changed, 4 insertions, 1 deletions
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
}