diff --git a/audit/audit.go b/audit/audit.go index 39eb87fa48d3d4149916e76ac1b2eb52f3d273d5..8c8052427a1dd43b660e3ded7293b422500e0001 100644 --- a/audit/audit.go +++ b/audit/audit.go @@ -2,6 +2,7 @@ package audit import ( "encoding/json" + "fmt" "gitlab.com/uafrica/go-utils/errors" "reflect" "regexp" @@ -79,6 +80,11 @@ func GetChanges(original interface{}, new interface{}) (map[string]interface{}, index, _ := string_utils.StringToInt64(indexString) field := ToSnakeCase(change.Path[2]) + if len(change.Path) == 5 && string_utils.IsNumericString(change.Path[3]) { + // The field is actually an array of objects. + field += fmt.Sprintf("[%s] (%s)", change.Path[3], ToSnakeCase(change.Path[4])) + } + arrayObject, present := changes[objectKey] if present { if arrayOfObjects, ok := arrayObject.([]map[string]interface{}); ok {