package common func NewApprovalUpdates(cu *CarUpdate) ApprovalUpdate { a := ApprovalUpdate{} a.Update(cu) return a } type ApprovalUpdate struct { ID int64 `json:"id,omitempty"` VIN string `json:"vin"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Description string `json:"description,omitempty"` ReleaseNotes string `json:"release_notes,omitempty"` } func (a *ApprovalUpdate) Update(cu *CarUpdate) { a.ID = cu.ID a.VIN = cu.VIN if cu.UpdateManifest == nil { return } m := cu.UpdateManifest a.Name = m.Name a.Version = m.Version a.Description = m.Description a.ReleaseNotes = m.ReleaseNotes }