diff options
Diffstat (limited to 'customer/controller.go')
-rw-r--r-- | customer/controller.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/customer/controller.go b/customer/controller.go index ae6101f..2bacd02 100644 --- a/customer/controller.go +++ b/customer/controller.go @@ -99,7 +99,6 @@ func handleSaveCustomer (ctx *gin.Context) { userId := uId.(uint) customer.UserID = userId - customer.Contact.UserID = userId err := customer.upsert() if err != nil { @@ -134,7 +133,13 @@ func handleDelCustomer (ctx *gin.Context) { userId := uId.(uint) customer.UserID = userId - // TODO: if userid and customer's user id don't match, dont delete + err = checkCustomerOwnership(customer.ID, customer.UserID) + if err != nil { + ctx.Error(err) + ctx.Abort() + return + } + err = customer.del() if err != nil { ctx.Error(err) |