2022-08-25 19:26:29 -06:00
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2022-12-02 20:40:58 -07:00
|
|
|
sourcePkg "github.com/fastenhealth/fasten-sources/clients/models"
|
2022-08-25 19:26:29 -06:00
|
|
|
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
|
|
|
|
)
|
|
|
|
|
2022-08-31 20:06:12 -06:00
|
|
|
//go:generate mockgen -source=interface.go -destination=mock/mock_database.go
|
2022-08-25 19:26:29 -06:00
|
|
|
type DatabaseRepository interface {
|
|
|
|
Close() error
|
2022-12-03 13:48:35 -07:00
|
|
|
Migrate() error
|
2022-09-11 21:59:13 -06:00
|
|
|
|
|
|
|
CreateUser(context.Context, *models.User) error
|
2022-12-02 20:40:58 -07:00
|
|
|
|
2022-12-03 13:48:35 -07:00
|
|
|
GetUserByUsername(context.Context, string) (*models.User, error)
|
2022-12-02 20:40:58 -07:00
|
|
|
GetCurrentUser(context.Context) *models.User
|
|
|
|
|
|
|
|
GetSummary(ctx context.Context) (*models.Summary, error)
|
|
|
|
|
|
|
|
GetResourceBySourceType(context.Context, string, string) (*models.ResourceFhir, error)
|
|
|
|
GetResourceBySourceId(context.Context, string, string) (*models.ResourceFhir, error)
|
|
|
|
ListResources(context.Context, models.ListResourceQueryOptions) ([]models.ResourceFhir, error)
|
|
|
|
GetPatientForSources(ctx context.Context) ([]models.ResourceFhir, 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)
|
|
|
|
|
|
|
|
//used by Client
|
|
|
|
UpsertRawResource(ctx context.Context, sourceCredentials sourcePkg.SourceCredential, rawResource sourcePkg.RawResourceFhir) (bool, error)
|
2022-08-25 19:26:29 -06:00
|
|
|
}
|