Skip to content

Commit

Permalink
make sure that we create associations for newly created resources (in…
Browse files Browse the repository at this point in the history
… the Fasten source) to the Encounter
  • Loading branch information
AnalogJ committed Dec 3, 2023
1 parent 4e70e2a commit 83d6d6f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions clients/internal/manual/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ func (m ManualClient) SyncAllBundle(db models.DatabaseRepository, bundleFile *os
syncErrors[apiModel.SourceResourceType] = err
continue
}

if apiModel.ReferencedResources == nil || len(apiModel.ReferencedResources) == 0 {
//if the created resources do not have any referenced resources, lets add the association to the encounter
err = db.UpsertRawResourceAssociation(m.Context, encounterSourceId, encounterResourceType, encounterResourceId, m.SourceCredential.GetSourceId(), apiModel.SourceResourceType, apiModel.SourceResourceID)
if err != nil {
syncErrors[fmt.Sprintf("contained association (%d)", ndx)] = err
continue
}
}
}

//loop though all the entries (references), and process them
Expand Down

0 comments on commit 83d6d6f

Please sign in to comment.