Skip to content

Commit

Permalink
fix: GET using id
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Aug 17, 2022
1 parent 06ddf02 commit 0bb855b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/api/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,15 @@ func ReadPaymentHandler(db *mongo.Database) http.HandlerFunc {
handleServerError(w, r, ret.Err())
return
}
type Object struct {
Items []payments.Payment `bson:"items"`
}
ob := &Object{}
ob := &payments.Payment{}
err = ret.Decode(ob)
if err != nil {
handleServerError(w, r, err)
return
}

err = json.NewEncoder(w).Encode(sharedapi.BaseResponse[payments.Payment]{
Data: &ob.Items[0],
Data: ob,
})
if err != nil {
handleServerError(w, r, err)
Expand Down

0 comments on commit 0bb855b

Please sign in to comment.