diff --git a/profile/profile.go b/profile/profile.go index 58dc1c5a..53687ed4 100644 --- a/profile/profile.go +++ b/profile/profile.go @@ -9,9 +9,9 @@ import ( // Profile is a configuration profile type Profile struct { - UUID string `plist:"-" json:"profile_uuid" db:"profile_uuid"` + UUID string `plist:"-" json:"profile_uuid,omitempty" db:"profile_uuid"` PayloadIdentifier string `json:"payload_identifier" db:"identifier"` - Data string `json:"data" db:"data"` + Data string `json:"data,omitempty" db:"data"` } // Logger adds a logger to the database config diff --git a/workflow/service.go b/workflow/service.go index c6338f71..2ff0fc3a 100644 --- a/workflow/service.go +++ b/workflow/service.go @@ -36,10 +36,16 @@ func (svc workflowService) CreateWorkflow(wfRequest *Workflow) (*Workflow, error } // if this loop fails the workflow already exists // need to delete the workflow? ugh + // also, the PayloadIdentifier is not validated + // it should be for _, pf := range wfRequest.Profiles { if err := svc.db.AddProfile(wf.UUID, pf.UUID); err != nil { return nil, errors.Wrap(err, "createworkflow failed to add profile") } + wf.Profiles = append(wf.Profiles, configProfile{ + UUID: pf.UUID, + PayloadIdentifier: pf.PayloadIdentifier, + }) } return wf, nil }