From 69136bf9071abf680deae022015c473052fbc255 Mon Sep 17 00:00:00 2001 From: Albin Antony Date: Wed, 1 Nov 2023 12:06:33 +0530 Subject: [PATCH] Fix #431 Update data attribute is returns empty response --- .../config/dataattribute/config_update_dataattribute.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/handler/v2/config/dataattribute/config_update_dataattribute.go b/internal/handler/v2/config/dataattribute/config_update_dataattribute.go index 533a54b..8a31087 100644 --- a/internal/handler/v2/config/dataattribute/config_update_dataattribute.go +++ b/internal/handler/v2/config/dataattribute/config_update_dataattribute.go @@ -27,13 +27,14 @@ func validateReq(dataAttributeReq updateDataAttributeReq, organisationId string) func updateDataAttributeFromReq(dataAttributeId string, requestBody updateDataAttributeReq, dataAttributes []dataagreement.DataAttribute) ([]dataagreement.DataAttribute, int) { updatedDataAttributes := make([]dataagreement.DataAttribute, len(dataAttributes)) + updatedDataAttributes = dataAttributes for i, dataAttribute := range dataAttributes { if dataAttribute.Id.Hex() == dataAttributeId { - dataAttributes[i].Name = requestBody.DataAttribute.Name - dataAttributes[i].Description = requestBody.DataAttribute.Description - dataAttributes[i].Sensitivity = requestBody.DataAttribute.Sensitivity - dataAttributes[i].Category = requestBody.DataAttribute.Category + updatedDataAttributes[i].Name = requestBody.DataAttribute.Name + updatedDataAttributes[i].Description = requestBody.DataAttribute.Description + updatedDataAttributes[i].Sensitivity = requestBody.DataAttribute.Sensitivity + updatedDataAttributes[i].Category = requestBody.DataAttribute.Category return updatedDataAttributes, i }