Skip to content

Commit

Permalink
Merge pull request #67 from BuxOrg/siggi/graphql-updates
Browse files Browse the repository at this point in the history
Updated graphql endpoints to latest bux changes
  • Loading branch information
mergify[bot] authored May 6, 2022
2 parents b8bde59 + 801f84f commit 3559c42
Show file tree
Hide file tree
Showing 7 changed files with 935 additions and 55 deletions.
12 changes: 11 additions & 1 deletion actions/graphql/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/julienschmidt/httprouter"
apirouter "github.com/mrz1836/go-api-router"
"github.com/mrz1836/go-logger"
"github.com/vektah/gqlparser/v2/gqlerror"
)

const (
Expand Down Expand Up @@ -60,10 +61,19 @@ func RegisterRoutes(router *apirouter.Router, appConfig *config.AppConfig, servi
"query": re.ReplaceAllString(oc.RawQuery, " "),
"variables": oc.Variables,
}
// LogParamsFormat "request_id=\"%s\" method=\"%s\" path=\"%s\" ip_address=\"%s\" user_agent=\"%s\" params=\"%v\"\n"
// LogParamsFormat "request_id=\"%s\" method=\"%s\" path=\"%s\" ip_address=\"%s\" user_agent=\"%s\" params=\"%v\"\n"
logger.NoFilePrintf(apirouter.LogParamsFormat, reqInfo.id, reqInfo.method, reqInfo.path, reqInfo.ip, reqInfo.userAgent, params)
return next(ctx)
})
srv.SetErrorPresenter(func(ctx context.Context, err error) *gqlerror.Error {
// LogErrorFormat "request_id=\"%s\" ip_address=\"%s\" type=\"%s\" internal_message=\"%s\" code=%d\n"
reqInfo := ctx.Value(config.GraphRequestInfo).(requestInfo)
logger.NoFilePrintf(apirouter.LogErrorFormat, reqInfo.id, reqInfo.ip, "GraphQL", err.Error(), 500)
return &gqlerror.Error{
Message: "presented: " + err.Error(),
Path: graphql.GetPath(ctx),
}
})
}

// Set the handle
Expand Down
6 changes: 3 additions & 3 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions gqlgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ models:
model: github.com/BuxOrg/bux.ChangeStrategy
Destination:
model: github.com/BuxOrg/bux.Destination
DestinationInput:
model: github.com/BuxOrg/bux.Destination
DraftStatus:
model: github.com/BuxOrg/bux.DraftStatus
DraftTransaction:
model: github.com/BuxOrg/bux.DraftTransaction
FeeUnit:
model: github.com/BuxOrg/bux/utils.FeeUnit
FeeUnitInput:
model: github.com/BuxOrg/bux/utils.FeeUnit
Metadata:
model: github.com/BuxOrg/bux.Metadata
OpReturnMap:
Expand All @@ -75,6 +79,10 @@ models:
model: github.com/BuxOrg/bux.PaymailP4
QueryParams:
model: github.com/BuxOrg/bux/datastore.QueryParams
SyncConfig:
model: github.com/BuxOrg/bux.SyncConfig
SyncConfigInput:
model: github.com/BuxOrg/bux.SyncConfig
Transaction:
model: github.com/BuxOrg/bux.Transaction
TransactionConfig:
Expand All @@ -85,6 +93,8 @@ models:
model: github.com/BuxOrg/bux.TransactionInput
ScriptOutput:
model: github.com/BuxOrg/bux.ScriptOutput
ScriptOutputInput:
model: github.com/BuxOrg/bux.ScriptOutput
Scripts:
model: github.com/BuxOrg/bux.Scripts
TransactionDirection:
Expand Down
Loading

0 comments on commit 3559c42

Please sign in to comment.