Replace raw call to remove_campsite_type_carousel_slide with Go func
This commit is contained in:
parent
b704f2789d
commit
17aaf045bb
|
@ -195,12 +195,14 @@ func editSlide(w http.ResponseWriter, r *http.Request, user *auth.User, company
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func deleteSlide(w http.ResponseWriter, r *http.Request, user *auth.User, conn *database.Conn, typeSlug string, mediaId int) {
|
func deleteSlide(w http.ResponseWriter, r *http.Request, user *auth.User, conn *database.Conn, typeSlug string, mediaID int) {
|
||||||
if err := user.VerifyCSRFToken(r); err != nil {
|
if err := user.VerifyCSRFToken(r); err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusForbidden)
|
http.Error(w, err.Error(), http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
conn.MustExec(r.Context(), "select remove_campsite_type_carousel_slide($1, $2)", typeSlug, mediaId)
|
if err := conn.RemoveCampsiteTypeCarouselSlide(r.Context(), typeSlug, mediaID); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
httplib.Redirect(w, r, "/admin/campsites/types/"+typeSlug+"/slides", http.StatusSeeOther)
|
httplib.Redirect(w, r, "/admin/campsites/types/"+typeSlug+"/slides", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,11 @@ func (tx *Tx) TranslateCampsiteTypeCarouselSlide(ctx context.Context, typeSlug s
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Conn) RemoveCampsiteTypeCarouselSlide(ctx context.Context, typeSlug string, mediaID int) error {
|
||||||
|
_, err := c.Exec(ctx, "select remove_campsite_type_carousel_slide($1, $2)", typeSlug, mediaID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Conn) SetupRedsys(ctx context.Context, companyID int, merchantCode string, terminalNumber int, environment string, integration string, encryptKey string) error {
|
func (c *Conn) SetupRedsys(ctx context.Context, companyID int, merchantCode string, terminalNumber int, environment string, integration string, encryptKey string) error {
|
||||||
var encryptKeyParam interface{}
|
var encryptKeyParam interface{}
|
||||||
if encryptKey != "" {
|
if encryptKey != "" {
|
||||||
|
|
Loading…
Reference in New Issue