aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/item/hooks.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-11 21:06:36 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2025-10-11 21:06:36 +0530
commit997b038761b8dd606e4041d8c8dc8bbf6f036033 (patch)
tree156bab13e8c2566e67df43189a612b7cebccda14 /item/hooks.go
parent99aee928a64649be75c4698b8e856e3ea05bc695 (diff)
Removed Brand and added BrandName and Category as item fieldsv0.18.0
Diffstat (limited to 'item/hooks.go')
-rw-r--r--item/hooks.go25
1 files changed, 0 insertions, 25 deletions
diff --git a/item/hooks.go b/item/hooks.go
index 5056cb1..cd8d47c 100644
--- a/item/hooks.go
+++ b/item/hooks.go
@@ -19,7 +19,6 @@ package item
import (
"gorm.io/gorm"
- "vidhukant.com/openbills/errors"
)
func (i *SavedItem) BeforeSave(tx *gorm.DB) error {
@@ -32,27 +31,3 @@ func (i *SavedItem) BeforeSave(tx *gorm.DB) error {
return nil
}
-
-func (b *Brand) BeforeSave(tx *gorm.DB) error {
- err := b.validate()
- if err != nil {
- return err
- }
-
- return nil
-}
-
-func (b *Brand) BeforeDelete(tx *gorm.DB) error {
- // if ID is 0, brand won't be deleted
- if b.ID == 0 {
- return errors.ErrNoWhereCondition
- }
-
- // delete all items
- err := db.Where("brand_id = ?", b.ID).Delete(&SavedItem{}).Error
- if err != nil {
- return err
- }
-
- return nil
-}