make sure null is handled correctly.

This commit is contained in:
Jason Kulatunga 2022-08-30 20:24:37 -07:00
parent 05b13677a6
commit 9902daa75d
2 changed files with 10 additions and 8 deletions

View File

@ -36,18 +36,16 @@ func (c CignaClient) SyncAll(db database.DatabaseRepository) error {
resources = append(resources, resource)
}
//////////////////////////////////////////////////////////////////////
// Patient
//////////////////////////////////////////////////////////////////////
patientResources := []fhir401.Patient{}
for _, resource := range resources {
if patient, isPatient := resource.(fhir401.Patient); isPatient {
patientResources = append(patientResources, patient)
}
}
c.Logger.Infof("patients lenght: %v", len(patientResources))
patientProfiles, err := c.ProcessPatients(patientResources)
//patientProfile. = c.Source.ID
c.Logger.Infof("CREATING PATIENT PROFILES: %v", patientProfiles)
for _, profile := range patientProfiles {
err = db.UpsertProfile(context.Background(), profile)
if err != nil {
@ -55,5 +53,9 @@ func (c CignaClient) SyncAll(db database.DatabaseRepository) error {
}
}
//////////////////////////////////////////////////////////////////////
// Patient
//////////////////////////////////////////////////////////////////////
return nil
}

View File

@ -26,10 +26,10 @@ type OriginBase struct {
UserID uuid.UUID `json:"user_id"`
Source Source `json:"source" gorm:"-"`
SourceID uuid.UUID `json:"source_id" gorm:"uniqueIndex:idx_source_resource_id"`
SourceID uuid.UUID `json:"source_id" gorm:"not null;uniqueIndex:idx_source_resource_id"`
SourceResourceType string `json:"source_resource_type" gorm:"uniqueIndex:idx_source_resource_id"`
SourceResourceID string `json:"source_resource_id" gorm:"uniqueIndex:idx_source_resource_id"`
SourceResourceType string `json:"source_resource_type" gorm:"not null;uniqueIndex:idx_source_resource_id"`
SourceResourceID string `json:"source_resource_id" gorm:"not null;uniqueIndex:idx_source_resource_id"`
}
func (o OriginBase) GetSourceID() uuid.UUID {