make sure sortTitle and sortDate is stored with every resource in the database.

This commit is contained in:
Jason Kulatunga 2023-01-07 09:41:43 -08:00
parent 3dfce9d3a4
commit ba333fce42
4 changed files with 9 additions and 3 deletions

View File

@ -196,6 +196,8 @@ func (sr *SqliteRepository) UpsertRawResource(ctx context.Context, sourceCredent
SourceResourceID: rawResource.SourceResourceID,
SourceResourceType: rawResource.SourceResourceType,
},
SortTitle: rawResource.SortTitle,
SortDate: rawResource.SortDate,
ResourceRaw: datatypes.JSON(rawResource.ResourceRaw),
RelatedResourceFhir: nil,
}

View File

@ -2,11 +2,15 @@ package models
import (
"gorm.io/datatypes"
"time"
)
type ResourceFhir struct {
OriginBase
SortDate time.Time `json:"sort_date" gorm:"sort_date"`
SortTitle string `json:"sort_title" gorm:"sort_title"`
//embedded data
ResourceRaw datatypes.JSON `json:"resource_raw" gorm:"resource_raw"`

2
go.mod
View File

@ -5,7 +5,7 @@ go 1.18
require (
github.com/analogj/go-util v0.0.0-20210417161720-39b497cca03b
github.com/dominikbraun/graph v0.15.0
github.com/fastenhealth/fasten-sources v0.0.8
github.com/fastenhealth/fasten-sources v0.0.11
github.com/gin-gonic/gin v1.8.1
github.com/glebarez/sqlite v1.5.0
github.com/golang-jwt/jwt/v4 v4.4.2

4
go.sum
View File

@ -74,8 +74,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fastenhealth/fasten-sources v0.0.8 h1:wDL9s47GT1PZw+Gg8rZb/jclGvyaND4q5Zdit94zL08=
github.com/fastenhealth/fasten-sources v0.0.8/go.mod h1:NBh0n2OBwJC10CHqkIx4WYQcDBRywJU4TAR8rSfR2Ts=
github.com/fastenhealth/fasten-sources v0.0.11 h1:GuU/fEs7yMtFY+Pe0j9z4XzJQtEZ3Yx3pDNqzsAWnOk=
github.com/fastenhealth/fasten-sources v0.0.11/go.mod h1:NBh0n2OBwJC10CHqkIx4WYQcDBRywJU4TAR8rSfR2Ts=
github.com/fastenhealth/gofhir-models v0.0.4 h1:Q//StwNXGfK+WAS2DckGBHAP1R4cHMRZEF/sLGgmR04=
github.com/fastenhealth/gofhir-models v0.0.4/go.mod h1:xB8ikGxu3bUq2b1JYV+CZpHqBaLXpOizFR0eFBCunis=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=