diff --git a/internal/wrappers/scans-modifier.go b/internal/wrappers/scans-modifier.go new file mode 100644 index 000000000..b8025f914 --- /dev/null +++ b/internal/wrappers/scans-modifier.go @@ -0,0 +1,28 @@ +package wrappers + +import ( + "bytes" + "encoding/json" + "time" +) + +// UnmarshalJSON Function normalizes description to ScanResult +func (s *ScanResponseModel) UnmarshalJSON(data []byte) error { + type Alias ScanResponseModel + aux := &struct { + *Alias + }{ + Alias: (*Alias)(s), + } + + reader := bytes.NewReader(data) + decoder := json.NewDecoder(reader) + decoder.UseNumber() + if err := decoder.Decode(&aux); err != nil { + return err + } + + s.CreatedAt = s.CreatedAt.In(time.Local) + + return nil +}