From eec30ba8bfb4e248892f62df8808e6f25074afb8 Mon Sep 17 00:00:00 2001 From: Geoffrey Ragot Date: Wed, 17 Aug 2022 09:37:55 +0200 Subject: [PATCH] fix: GET using id --- pkg/api/http.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/api/http.go b/pkg/api/http.go index 814a9c12..55b13e1c 100644 --- a/pkg/api/http.go +++ b/pkg/api/http.go @@ -146,10 +146,7 @@ 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) @@ -157,7 +154,7 @@ func ReadPaymentHandler(db *mongo.Database) http.HandlerFunc { } err = json.NewEncoder(w).Encode(sharedapi.BaseResponse[payments.Payment]{ - Data: &ob.Items[0], + Data: ob, }) if err != nil { handleServerError(w, r, err)