From 8ee91eb7a9414f0bf71d58c9a257e22e7138ac7f Mon Sep 17 00:00:00 2001 From: Peter Grlica Date: Fri, 21 May 2021 14:11:56 +0200 Subject: [PATCH] Fixed federation structure sync, added a response wrapper to api response --- pkg/federation/corteza.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/pkg/federation/corteza.go b/pkg/federation/corteza.go index 23775b32c..6f0ab19fa 100644 --- a/pkg/federation/corteza.go +++ b/pkg/federation/corteza.go @@ -8,20 +8,26 @@ import ( type ( EncoderAdapterCortezaInternal struct{} + + ResponseWrapper struct { + Response interface{} `json:"response"` + } ) // Build a default Corteza response func (a EncoderAdapterCortezaInternal) BuildStructure(w io.Writer, o options.FederationOpt, p interface{}) (interface{}, error) { - return listModuleResponseCortezaInternal{ - Filter: p.(ListStructurePayload).Filter, - Set: p.(ListStructurePayload).Set, - }, nil + return ResponseWrapper{ + Response: listModuleResponseCortezaInternal{ + Filter: p.(ListStructurePayload).Filter, + Set: p.(ListStructurePayload).Set, + }}, nil } // Build a default Corteza response func (a EncoderAdapterCortezaInternal) BuildData(w io.Writer, o options.FederationOpt, p interface{}) (interface{}, error) { - return listRecordResponseCortezaInternal{ - Filter: p.(ListDataPayload).Filter, - Set: p.(ListDataPayload).Set, - }, nil + return ResponseWrapper{ + Response: listRecordResponseCortezaInternal{ + Filter: p.(ListDataPayload).Filter, + Set: p.(ListDataPayload).Set, + }}, nil }