Skip to content

Commit

Permalink
Revert "release: staging to production (#378)"
Browse files Browse the repository at this point in the history
This reverts commit b4d2eaf.
  • Loading branch information
Salaton committed Feb 29, 2024
1 parent b4d2eaf commit e12ce74
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 43 deletions.
2 changes: 1 addition & 1 deletion pkg/clinical/domain/patient.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ type FHIRPatientInput struct {
Link []*FHIRPatientLinkInput `json:"link,omitempty"`

// Meta stores more information about the resource
Meta *FHIRMetaInput `json:"meta,omitempty"`
Meta FHIRMetaInput `json:"meta,omitempty"`

// Extension is an optional element that provides additional information not captured in the basic resource definition
Extension []*FHIRExtension `json:"extension,omitempty"`
Expand Down
11 changes: 5 additions & 6 deletions pkg/clinical/presentation/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/savannahghi/clinical/pkg/clinical/presentation/graph"
"github.com/savannahghi/clinical/pkg/clinical/presentation/graph/generated"
"github.com/savannahghi/clinical/pkg/clinical/presentation/rest"
"github.com/savannahghi/clinical/pkg/clinical/usecases/clinical"
"github.com/savannahghi/clinical/pkg/clinical/usecases"
"github.com/savannahghi/serverutils"
"google.golang.org/api/healthcare/v1"
)
Expand All @@ -52,7 +52,6 @@ var ClinicalAllowedOrigins = []string{
"https://staging-empower.web.app",
"https://uat.empower.savannahghi.org",
"https://empower.savannahghi.org",
"https://review-uzazi-salama.web.app",
}

var (
Expand Down Expand Up @@ -123,13 +122,13 @@ func StartServer(

infrastructure := infrastructure.NewInfrastructureInteractor(baseExtension, fhir, ocl, upload, pubsubSvc, advantageSvc)

usecases := clinical.NewUseCasesClinicalImpl(infrastructure)
usecases := usecases.NewUsecasesInteractor(infrastructure)

r := gin.Default()

memoryStore := persist.NewMemoryStore(60 * time.Minute)

SetupRoutes(r, memoryStore, authclient, *usecases, infrastructure)
SetupRoutes(r, memoryStore, authclient, usecases, infrastructure)

addr := fmt.Sprintf(":%d", port)

Expand All @@ -138,7 +137,7 @@ func StartServer(
}
}

func SetupRoutes(r *gin.Engine, cacheStore persist.CacheStore, authclient *authutils.Client, usecases clinical.UseCasesClinicalImpl, infra infrastructure.Infrastructure) {
func SetupRoutes(r *gin.Engine, cacheStore persist.CacheStore, authclient *authutils.Client, usecases usecases.Interactor, infra infrastructure.Infrastructure) {
r.Use(cors.New(cors.Config{
AllowOrigins: ClinicalAllowedOrigins,
AllowMethods: []string{http.MethodPut, http.MethodPatch, http.MethodGet, http.MethodPost, http.MethodDelete, http.MethodOptions},
Expand Down Expand Up @@ -207,7 +206,7 @@ func SetupRoutes(r *gin.Engine, cacheStore persist.CacheStore, authclient *authu
}

// GQLHandler sets up a GraphQL resolver
func GQLHandler(service clinical.UseCasesClinicalImpl) gin.HandlerFunc {
func GQLHandler(service usecases.Interactor) gin.HandlerFunc {
resolver, err := graph.NewResolver(service)
if err != nil {
log.Panicf("failed to start graph resolver: %s", err)
Expand Down
50 changes: 25 additions & 25 deletions pkg/clinical/presentation/graph/clinical.resolvers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/clinical/presentation/graph/resolver.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package graph

import (
"github.com/savannahghi/clinical/pkg/clinical/usecases/clinical"
"github.com/savannahghi/clinical/pkg/clinical/usecases"
)

//go:generate go run github.com/99designs/gqlgen

// Resolver wires up the resolvers needed for the clinical services
type Resolver struct {
usecases clinical.UseCasesClinicalImpl
usecases usecases.Interactor
}

// NewResolver initializes a working top leve Resolver that has been initialized
// with all necessary dependencies
func NewResolver(usecases clinical.UseCasesClinicalImpl) (*Resolver, error) {
func NewResolver(usecases usecases.Interactor) (*Resolver, error) {
return &Resolver{
usecases: usecases,
}, nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/clinical/presentation/rest/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/savannahghi/clinical/pkg/clinical/application/utils"
"github.com/savannahghi/clinical/pkg/clinical/domain"
"github.com/savannahghi/clinical/pkg/clinical/infrastructure/services/advantage"
"github.com/savannahghi/clinical/pkg/clinical/usecases/clinical"
"github.com/savannahghi/clinical/pkg/clinical/usecases"
"github.com/savannahghi/errorcodeutil"
"github.com/savannahghi/pubsubtools"
"github.com/savannahghi/serverutils"
Expand All @@ -26,13 +26,13 @@ type BaseExtension interface {

// PresentationHandlersImpl represents the usecase implementation object
type PresentationHandlersImpl struct {
usecases clinical.UseCasesClinicalImpl
usecases usecases.Interactor
baseExt BaseExtension
advantageService advantage.AdvantageService
}

// NewPresentationHandlers initializes a new rest handlers usecase
func NewPresentationHandlers(usecases clinical.UseCasesClinicalImpl, extension BaseExtension, advantageSvc advantage.AdvantageService) *PresentationHandlersImpl {
func NewPresentationHandlers(usecases usecases.Interactor, extension BaseExtension, advantageSvc advantage.AdvantageService) *PresentationHandlersImpl {
return &PresentationHandlersImpl{
usecases: usecases,
baseExt: extension,
Expand Down
6 changes: 3 additions & 3 deletions pkg/clinical/presentation/rest/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
fakePubSubMock "github.com/savannahghi/clinical/pkg/clinical/infrastructure/services/pubsub/mock"
fakeUploadMock "github.com/savannahghi/clinical/pkg/clinical/infrastructure/services/upload/mock"
"github.com/savannahghi/clinical/pkg/clinical/presentation"
"github.com/savannahghi/clinical/pkg/clinical/usecases/clinical"
"github.com/savannahghi/clinical/pkg/clinical/usecases"
"github.com/savannahghi/interserviceclient"
"github.com/savannahghi/pubsubtools"
"github.com/savannahghi/serverutils"
Expand Down Expand Up @@ -259,7 +259,7 @@ func TestPresentationHandlersImpl_ReceivePubSubPushMessage(t *testing.T) {
fakePubSub := fakePubSubMock.NewPubSubServiceMock()
fakeAdvantage := fakeAdvantageMock.NewFakeAdvantageMock()
infra := infrastructure.NewInfrastructureInteractor(fakeExt, fakeFHIR, fakeOCL, fakeUpload, fakePubSub, fakeAdvantage)
usecases := clinical.NewUseCasesClinicalImpl(infra)
usecases := usecases.NewUsecasesInteractor(infra)

if tt.name == "happy case: publish create patient message" {
msg := dto.PatientPubSubMessage{
Expand Down Expand Up @@ -685,7 +685,7 @@ func TestPresentationHandlersImpl_ReceivePubSubPushMessage(t *testing.T) {
req.Header.Add(k, v)
}

presentation.SetupRoutes(engine, testMemoryStore, authclient, *usecases, infra)
presentation.SetupRoutes(engine, testMemoryStore, authclient, usecases, infra)
engine.ServeHTTP(w, req)

resp := w.Result()
Expand Down
2 changes: 1 addition & 1 deletion pkg/clinical/usecases/clinical/patient.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func (c *UseCasesClinicalImpl) CreatePatient(ctx context.Context, input dto.Pati
return nil, err
}

patientInput.Meta = &domain.FHIRMetaInput{
patientInput.Meta = domain.FHIRMetaInput{
Tag: tags,
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/clinical/usecases/clinical/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (c *UseCasesClinicalImpl) CreatePubsubPatient(ctx context.Context, payload
return err
}

patientInput.Meta = &domain.FHIRMetaInput{
patientInput.Meta = domain.FHIRMetaInput{
Tag: tags,
}

Expand Down

0 comments on commit e12ce74

Please sign in to comment.