Skip to content
Snippets Groups Projects
Commit f394ffaf authored by meskio's avatar meskio :tent:
Browse files

Delete products permanently

parent 8703cc73
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,9 @@ func (a *api) GetProduct(w http.ResponseWriter, req *http.Request) {
func (a *api) DeleteProduct(w http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)
err := a.db.Where("code = ?", vars["code"]).Delete(&Product{}).Error
err := a.db.Unscoped().
Where("code = ?", vars["code"]).
Delete(&Product{}).Error
if err != nil {
log.Printf("Can't delete product %s: %v", vars["code"], err)
w.WriteHeader(http.StatusInternalServerError)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment