Add a Go function for delete_service SQL function
This commit is contained in:
parent
6463674c62
commit
36213c75de
|
@ -151,6 +151,11 @@ func (c *Conn) OrderServices(ctx context.Context, ids []int) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Conn) RemoveService(ctx context.Context, id int) error {
|
||||||
|
_, err := c.Exec(ctx, "select remove_service($1)", id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (tx *Tx) AddSurroundingsHighlight(ctx context.Context, companyID int, mediaID int, name string, description string) (int, error) {
|
func (tx *Tx) AddSurroundingsHighlight(ctx context.Context, companyID int, mediaID int, name string, description string) (int, error) {
|
||||||
return tx.GetInt(ctx, "select add_surroundings_highlight($1, $2, $3, $4)", companyID, mediaID, name, description)
|
return tx.GetInt(ctx, "select add_surroundings_highlight($1, $2, $3, $4)", companyID, mediaID, name, description)
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,9 @@ func deleteService(w http.ResponseWriter, r *http.Request, user *auth.User, conn
|
||||||
http.Error(w, err.Error(), http.StatusForbidden)
|
http.Error(w, err.Error(), http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
conn.MustExec(r.Context(), "select remove_service($1)", id)
|
if err := conn.RemoveService(r.Context(), id); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
httplib.Redirect(w, r, "/admin/services", http.StatusSeeOther)
|
httplib.Redirect(w, r, "/admin/services", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue