fasten-onprem/backend/pkg/database/interface.go

46 lines
2.6 KiB
Go
Raw Normal View History

2022-08-25 19:26:29 -06:00
package database
import (
"context"
sourcePkg "github.com/fastenhealth/fasten-sources/clients/models"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg"
2022-08-25 19:26:29 -06:00
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
)
//go:generate mockgen -source=interface.go -destination=mock/mock_database.go
2022-08-25 19:26:29 -06:00
type DatabaseRepository interface {
Close() error
Migrate() error
CreateUser(context.Context, *models.User) error
GetUserByUsername(context.Context, string) (*models.User, error)
GetCurrentUser(ctx context.Context) (*models.User, error)
GetSummary(ctx context.Context) (*models.Summary, error)
GetResourceByResourceTypeAndId(context.Context, string, string) (*models.ResourceBase, error)
GetResourceBySourceId(context.Context, string, string) (*models.ResourceBase, error)
QueryResources(ctx context.Context, query models.QueryResource) ([]models.ResourceBase, error)
ListResources(context.Context, models.ListResourceQueryOptions) ([]models.ResourceBase, error)
GetPatientForSources(ctx context.Context) ([]models.ResourceBase, error)
2022-12-17 16:10:19 -07:00
AddResourceAssociation(ctx context.Context, source *models.SourceCredential, resourceType string, resourceId string, relatedSource *models.SourceCredential, relatedResourceType string, relatedResourceId string) error
RemoveResourceAssociation(ctx context.Context, source *models.SourceCredential, resourceType string, resourceId string, relatedSource *models.SourceCredential, relatedResourceType string, relatedResourceId string) error
FindResourceAssociationsByTypeAndId(ctx context.Context, source *models.SourceCredential, resourceType string, resourceId string) ([]models.RelatedResource, error)
GetFlattenedResourceGraph(ctx context.Context, graphType pkg.ResourceGraphType) (map[string][]*models.ResourceBase, error)
AddResourceComposition(ctx context.Context, compositionTitle string, resources []*models.ResourceBase) error
//UpsertProfile(context.Context, *models.Profile) error
//UpsertOrganziation(context.Context, *models.Organization) error
CreateSource(context.Context, *models.SourceCredential) error
GetSource(context.Context, string) (*models.SourceCredential, error)
GetSourceSummary(context.Context, string) (*models.SourceSummary, error)
GetSources(context.Context) ([]models.SourceCredential, error)
CreateGlossaryEntry(ctx context.Context, glossaryEntry *models.Glossary) error
GetGlossaryEntry(ctx context.Context, code string, codeSystem string) (*models.Glossary, error)
//used by fasten-sources Clients
UpsertRawResource(ctx context.Context, sourceCredentials sourcePkg.SourceCredential, rawResource sourcePkg.RawResourceFhir) (bool, error)
2022-08-25 19:26:29 -06:00
}