3
0

Fixed federation structure sync, added a response wrapper to api response

This commit is contained in:
Peter Grlica
2021-05-21 14:11:56 +02:00
committed by Denis Arh
parent 7d8cc55331
commit 8ee91eb7a9
+14 -8
View File
@@ -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
}