diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-11 20:55:48 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-10-11 20:55:48 +0530 |
commit | bc154857fb5569d7c1fa9785cc891cb927a6a156 (patch) | |
tree | 590c9f6a00a1b97b2ee45cfa5a767558089affe0 /customer/service.go | |
parent | 8a47978ca17d2f251d67d12b0e34fa26bb1e4ace (diff) |
removed per-user itemsv0.17.0
Diffstat (limited to 'customer/service.go')
-rw-r--r-- | customer/service.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/customer/service.go b/customer/service.go index 8cd2bde..a0ed4dc 100644 --- a/customer/service.go +++ b/customer/service.go @@ -37,8 +37,8 @@ func getCustomer(customer *Customer, id uint) error { return nil } -func getCustomers(customers *[]Customer, userId uint) error { - res := db.Where("user_id = ?", userId).Find(&customers) +func getCustomers(customers *[]Customer) error { + res := db.Find(&customers) // TODO: handle potential errors if res.Error != nil { @@ -60,14 +60,13 @@ func (c *Customer) upsert() error { } func (c *Customer) del() error { - res := db.Where("id = ? and user_id = ?", c.ID, c.UserID).Delete(c) + res := db.Where("id = ?", c.ID).Delete(c) // TODO: handle potential errors if res.Error != nil { return res.Error } - // returns 404 if either row doesn't exist or if the user doesn't own it if res.RowsAffected == 0 { return e.ErrNotFound } |