Skip to content

Commit

Permalink
Fix mapstructure decode send request
Browse files Browse the repository at this point in the history
  • Loading branch information
bbedward committed Jul 1, 2024
1 parent 2f97643 commit e9a5849
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apps/server/controller/block_c.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (hc *HttpController) HandleReceiveAllRequest(rawRequest *map[string]interfa
func (hc *HttpController) HandleSendRequest(rawRequest *map[string]interface{}, w http.ResponseWriter, r *http.Request) {
var sendRequest requests.SendRequest
if err := mapstructure.Decode(rawRequest, &sendRequest); err != nil {
log.Errorf("Error unmarshalling receive request %s", err)
log.Errorf("Error unmarshalling send request %s", err)
ErrUnableToParseJson(w, r)
return
} else if sendRequest.Wallet == "" || sendRequest.Action == "" || sendRequest.Amount == "" || sendRequest.Destination == "" {
Expand Down Expand Up @@ -144,7 +144,7 @@ func (hc *HttpController) HandleSendRequest(rawRequest *map[string]interface{},
func (hc *HttpController) HandleAccountRepresentativeSetRequest(rawRequest *map[string]interface{}, w http.ResponseWriter, r *http.Request) {
var changeRequest requests.AccountRepresentativeSetRequest
if err := mapstructure.Decode(rawRequest, &changeRequest); err != nil {
log.Errorf("Error unmarshalling receive request %s", err)
log.Errorf("Error unmarshalling representative set request %s", err)
ErrUnableToParseJson(w, r)
return
} else if changeRequest.Wallet == "" || changeRequest.Action == "" || changeRequest.Representative == "" {
Expand Down
4 changes: 2 additions & 2 deletions apps/server/models/requests/send_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type SendRequest struct {
BaseRequest `mapstructure:",squash"`
Source string `json:"source" mapstructure:"source"`
Destination string `json:"destination" mapstructure:"destination"`
Amount string `json:"-"` // Exclude from automatic unmarshalling
RawAmount json.RawMessage `json:"amount" mapstructure:"amount"`
Amount string `json:"-" mapstructure:"amount"` // Exclude from automatic unmarshalling
RawAmount json.RawMessage `json:"amount" mapstructure:"-"`
ID *string `json:"id,omitempty" mapstructure:"id,omitempty"`
Work *string `json:"work,omitempty" mapstructure:"work,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/banano/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: pippin-banano
image: bananocoin/pippin:3.0.9
image: bananocoin/pippin:3.0.10
imagePullPolicy: Always
resources:
requests:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/nano/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: pippin-nano
image: bananocoin/pippin:3.0.9
image: bananocoin/pippin:3.0.10
imagePullPolicy: Always
resources:
requests:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/wban/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: pippin-banano
image: bananocoin/pippin:3.0.9
image: bananocoin/pippin:3.0.10
imagePullPolicy: Always
resources:
requests:
Expand Down

0 comments on commit e9a5849

Please sign in to comment.