Skip to content
Snippets Groups Projects
Commit 3f763f68 authored by Francé Wilke's avatar Francé Wilke
Browse files

Fix build

parent c03e68f3
Branches
Tags v1.114.0
No related merge requests found
......@@ -2,7 +2,7 @@ package api_logs
import (
"github.com/thoas/go-funk"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/string_utils"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/number_utils"
"net/url"
"strings"
"time"
......@@ -41,7 +41,7 @@ func GenerateIncomingAPILog(startTime time.Time, requestID *string, claim map[st
if accountID == 0 {
if accountIDParam, ok := req.QueryStringParameters["account_id"]; ok {
if i64, err := string_utils.StringToInt64(accountIDParam); err == nil && i64 > 0 {
if i64, err := number_utils.StringToInt64(accountIDParam); err == nil && i64 > 0 {
accountID = i64
}
}
......@@ -49,7 +49,7 @@ func GenerateIncomingAPILog(startTime time.Time, requestID *string, claim map[st
if providerID == 0 {
if providerIDParam, ok := req.QueryStringParameters["provider_id"]; ok {
if i64, err := string_utils.StringToInt64(providerIDParam); err == nil && i64 > 0 {
if i64, err := number_utils.StringToInt64(providerIDParam); err == nil && i64 > 0 {
providerID = i64
}
}
......
......@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/map_utils"
"net/http"
"regexp"
"strconv"
......@@ -46,14 +47,14 @@ func Error(err error, msg string, statusCode int) (events.APIGatewayProxyRespons
if err != nil {
return events.APIGatewayProxyResponse{
StatusCode: statusCode,
Headers: utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Body: "{ \"error\": \"" + http.StatusText(http.StatusInternalServerError) + "\"}",
}, nil
}
return events.APIGatewayProxyResponse{
StatusCode: statusCode,
Headers: utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Body: string(bodyBytes),
}, errors.New(msg)
}
......@@ -136,7 +137,7 @@ func DatabaseServerError(err error, msg string) (events.APIGatewayProxyResponse,
if marshalError != nil {
return events.APIGatewayProxyResponse{
StatusCode: statusCode,
Headers: utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Body: "{ \"error\": \"" + http.StatusText(http.StatusInternalServerError) + "\"}",
}, nil
}
......@@ -148,7 +149,7 @@ func DatabaseServerError(err error, msg string) (events.APIGatewayProxyResponse,
return events.APIGatewayProxyResponse{
StatusCode: statusCode,
Headers: utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Body: string(bodyBytes),
}, err
}
......@@ -230,7 +231,7 @@ func ClientError(status int, message string) (events.APIGatewayProxyResponse, er
return events.APIGatewayProxyResponse{
StatusCode: status,
Headers: utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), responses.ContentTypeJSONHeader),
Body: string(b),
}, errors.New(message)
}
......
......@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/errors"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/number_utils"
"reflect"
"regexp"
"strconv"
......@@ -77,7 +78,7 @@ func GetChanges(original interface{}, new interface{}) (map[string]interface{},
continue
}
index, _ := string_utils.StringToInt64(indexString)
index, _ := number_utils.StringToInt64(indexString)
field := ToSnakeCase(change.Path[2])
if len(change.Path) == 5 && string_utils.IsNumericString(change.Path[3]) {
......
......@@ -98,7 +98,7 @@ func ServeSQSFunctions(ctx context.Context, lambdaHandler lambda.Handler, w http
Body: body,
MessageAttributes: map[string]events.SQSMessageAttribute{
"type": {
StringValue: utils.PointerValue(sqsType),
StringValue: utils.ValueToPointer(sqsType),
},
},
},
......
......@@ -2,6 +2,7 @@ package responses
import (
"encoding/json"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/map_utils"
"net/http"
"gitlab.bob.co.za/bob-public-utils/bobgroup-go-utils/logs"
......@@ -29,7 +30,7 @@ func NotFoundResponse(err error) (events.APIGatewayProxyResponse, error) {
func NoContent() (events.APIGatewayProxyResponse, error) {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusNoContent,
Headers: utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
}, nil
}
......@@ -45,7 +46,7 @@ func TooManyRequests(message string) (events.APIGatewayProxyResponse, error) {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusTooManyRequests,
Headers: utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
Body: string(responseJson),
}, nil
}
......@@ -85,7 +86,7 @@ func GenericResponse(statusCode int, body string, headers map[string]string) (ev
return events.APIGatewayProxyResponse{
StatusCode: statusCode,
Body: body + "\n",
Headers: utils.MergeMaps(utils.CorsHeaders(), headers),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), headers),
}, nil
}
......@@ -101,7 +102,7 @@ func MaintenanceResponse(message string) events.APIGatewayProxyResponse {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusTeapot,
Body: message,
Headers: utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
}
}
......@@ -109,13 +110,13 @@ func RateLimitResponse(message string) events.APIGatewayProxyResponse {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusTooManyRequests,
Body: message,
Headers: utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
}
}
func OptionsResponse() events.APIGatewayProxyResponse {
return events.APIGatewayProxyResponse{
StatusCode: http.StatusNoContent,
Headers: utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
Headers: map_utils.MergeMaps(utils.CorsHeaders(), ContentTypeJSONHeader),
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment