Skip to content

Commit

Permalink
replace boil.GetContextDB to sqlx.DB (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alva8756 authored Feb 4, 2024
1 parent 5a0d102 commit 9f6d3e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/api/v1/router_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package serverservice
import (
"encoding/json"
"errors"
"fmt"
"reflect"

"github.com/gin-gonic/gin"
Expand Down Expand Up @@ -116,6 +117,8 @@ func (r *Router) serverCreate(c *gin.Context) {
func (r *Router) serverDelete(c *gin.Context) {
dbSRV, err := r.loadServerFromParams(c)
if err != nil {
r.Logger.Error(fmt.Sprintf("failed to load server %v, err %v", dbSRV, err))

if errors.Is(err, ErrUUIDParse) {
badRequestResponse(c, "", err)
return
Expand All @@ -126,8 +129,10 @@ func (r *Router) serverDelete(c *gin.Context) {
return
}

if _, err = dbSRV.Delete(c.Request.Context(), boil.GetContextDB(), false); err != nil {
if _, err = dbSRV.Delete(c.Request.Context(), r.DB, false); err != nil {
r.Logger.Error(fmt.Sprintf("failed to delete server %v, err %v", dbSRV.ID, err))
dbErrorResponse(c, err)

return
}

Expand Down

0 comments on commit 9f6d3e7

Please sign in to comment.