Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…EASI-4470/dataloaders_linked
  • Loading branch information
samoddball committed Jul 9, 2024
2 parents 72033f0 + d391d7d commit 5518594
Show file tree
Hide file tree
Showing 21 changed files with 2,033 additions and 359 deletions.
115 changes: 115 additions & 0 deletions EASI.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1312,6 +1312,72 @@
},
"response": []
},
{
"name": "SystemIntake GetByID w/ Related Requests",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query systemIntake {\n systemIntake(id: \"{{systemIntakeID}}\") {\n id\n requestName\n relatedIntakes {\n id\n requestName\n }\n relatedTRBRequests {\n id\n name\n }\n }\n}",
"variables": ""
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "SystemIntake Get All w/ Related Requests",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query systemIntake {\n systemIntakes(openRequests: true) {\n id\n requestName\n relatedIntakes {\n id\n requestName\n }\n relatedTRBRequests {\n id\n name\n }\n }\n}",
"variables": ""
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "SystemIntake Get (Workflow state/statuses)",
"event": [
Expand Down Expand Up @@ -1630,6 +1696,55 @@
}
},
"response": []
},
{
"name": "GetByID w/ Related Requests",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query TRBRequestGetByID{\n \n trbRequest(id: \"{{trbRequestID}}\"){\n id\n name\n archived\n type\n status\n taskStatuses {\n formStatus\n feedbackStatus\n consultPrepStatus\n }\n feedback {\n id\n trbRequestId\n feedbackMessage\n copyTrbMailbox\n notifyEuaIds\n action\n createdBy\n createdAt\n modifiedBy\n modifiedAt\n }\n createdBy\n createdAt\n modifiedBy\n modifiedAt\n # form {\n # status\n # id\n # trbRequestId\n # component\n # needsAssistanceWith\n # hasSolutionInMind\n # whereInProcess\n # hasExpectedStartEndDates\n # collabGroups\n\n # createdBy\n # createdAt\n # modifiedBy\n # modifiedAt\n # }\n attendees{\n id\n euaUserId\n # userInfo {\n # euaUserId\n # commonName\n # email\n # }\n trbRequestId\n component\n role\n }\n \n \n }\n \n \n}",
"variables": ""
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "Get All w/ Related Requests",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query trbRequests{\n trbRequests {\n id\n name\n relatedIntakes {\n id\n requestName\n }\n relatedTRBRequests {\n id\n name\n }\n }\n}",
"variables": ""
}
},
"url": {
"raw": "http://localhost:8080/api/graph/query",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"api",
"graph",
"query"
]
}
},
"response": []
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/devdata/system_intake.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,9 @@ func updateSystemIntakeContractDetails(
plannedYearOneSpendingITPortion := "25%"
contractor := "Dr Doom"
startDate := time.Now().AddDate(-1, 0, 0)
hasContract := "HAVE_CONTRACT"
hasContract := "IN_PROGRESS"
endDate := time.Now().AddDate(3, 0, 0)
contractNumbers := []string{"123456789"}
contractNumbers := []string{}
input := models.UpdateSystemIntakeContractDetailsInput{
ID: intake.ID,
FundingSources: &models.SystemIntakeFundingSourcesInput{
Expand Down
81 changes: 75 additions & 6 deletions cmd/devdata/trb_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cms-enterprise/easi-app/cmd/devdata/mock"
"github.com/cms-enterprise/easi-app/pkg/easiencoding"
"github.com/cms-enterprise/easi-app/pkg/graph/resolvers"
"github.com/cms-enterprise/easi-app/pkg/local/cedarcoremock"
"github.com/cms-enterprise/easi-app/pkg/models"
)

Expand All @@ -38,6 +39,10 @@ func (s *seederConfig) seedTRBRequests(ctx context.Context) error {
s.seedTRBCase14,
s.seedTRBCase15,
s.seedTRBCase16,
s.seedTRBCase17,
s.seedTRBCase18,
s.seedTRBCase19,
s.seedTRBCase20,
}

for _, seedFunc := range cases {
Expand Down Expand Up @@ -387,7 +392,7 @@ func (s *seederConfig) seedTRBCase12(ctx context.Context) error {
if err != nil {
return err
}
_, err = s.addTRBNewSystemRelation(ctx, trbRequest.ID, []string{"123", "456"})
_, err = s.addTRBNewSystemRelation(ctx, trbRequest.ID, []string{"12345", "67890"})
if err != nil {
return err
}
Expand All @@ -399,7 +404,7 @@ func (s *seederConfig) seedTRBCase13(ctx context.Context) error {
if err != nil {
return err
}
_, err = s.addTRBExistingServiceRelation(ctx, trbRequest.ID, "Test Contract Name", []string{"123", "456"})
_, err = s.addTRBExistingServiceRelation(ctx, trbRequest.ID, "Test Contract Name", []string{"12345", "67890"})
if err != nil {
return err
}
Expand All @@ -414,10 +419,10 @@ func (s *seederConfig) seedTRBCase14(ctx context.Context) error {
_, err = s.addTRBExistingSystemRelation(
ctx,
trbRequest.ID,
[]string{"123", "456"}, // contract numbers
[]string{"00001", "00002"}, // contract numbers
[]string{ // cedar system IDs, these mock IDs are from the client helper
"{11AB1A00-1234-5678-ABC1-1A001B00CC0A}",
"{11AB1A00-1234-5678-ABC1-1A001B00CC2C}",
"{11AB1A00-1234-5678-ABC1-1A001B00CC1B}",
},
)
if err != nil {
Expand Down Expand Up @@ -446,7 +451,7 @@ func (s *seederConfig) seedTRBCase16(ctx context.Context) error {
_, err = s.addTRBExistingSystemRelation(
ctx,
trbRequest.ID,
[]string{"123", "456"}, // contract numbers
[]string{"ABC", "DEF"}, // contract numbers
[]string{ // cedar system IDs, these mock IDs are from the client helper
"{11AB1A00-1234-5678-ABC1-1A001B00CC6G}",
"{11AB1A00-1234-5678-ABC1-1A001B00CC5F}",
Expand All @@ -458,6 +463,70 @@ func (s *seederConfig) seedTRBCase16(ctx context.Context) error {
return nil
}

func (s *seederConfig) seedTRBCase17(ctx context.Context) error {
trbRequest, err := s.seedTRBWithForm(ctx, null.StringFrom("Case 17 - Completed request with related system (0A)").Ptr(), true)
if err != nil {
return err
}
_, err = s.addTRBExistingSystemRelation(
ctx,
trbRequest.ID,
[]string{"00002", "00003"}, // contract numbers
[]string{ // cedar system IDs, these mock IDs are from the client helper
"{11AB1A00-1234-5678-ABC1-1A001B00CC0A}",
"{11AB1A00-1234-5678-ABC1-1A001B00CC3D}",
},
)
if err != nil {
return err
}
return nil
}

func (s *seederConfig) seedTRBCase18(ctx context.Context) error {
trbRequest, err := s.seedTRBWithForm(ctx, null.StringFrom("Case 18 - Completed request with related system (1B)").Ptr(), true)
if err != nil {
return err
}
_, err = s.addTRBExistingSystemRelation(
ctx,
trbRequest.ID,
[]string{"00004", "00005"}, // contract numbers
[]string{ // cedar system IDs, these mock IDs are from the client helper
"{11AB1A00-1234-5678-ABC1-1A001B00CC1B}",
"{11AB1A00-1234-5678-ABC1-1A001B00CC4E}",
},
)
if err != nil {
return err
}
return nil
}

func (s *seederConfig) seedTRBCase19(ctx context.Context) error {
trbRequest, err := s.seedTRBWithForm(ctx, null.StringFrom("Case 19 - Completed request form with related contract (12345)").Ptr(), true)
if err != nil {
return err
}
_, err = s.addTRBExistingServiceRelation(ctx, trbRequest.ID, "Test Contract Name", []string{"12345", "00006"})
if err != nil {
return err
}
return nil
}

func (s *seederConfig) seedTRBCase20(ctx context.Context) error {
trbRequest, err := s.seedTRBWithForm(ctx, null.StringFrom("Case 20 - Completed request form with related contract (67890)").Ptr(), true)
if err != nil {
return err
}
_, err = s.addTRBExistingServiceRelation(ctx, trbRequest.ID, "Test Contract Name", []string{"00007", "67890"})
if err != nil {
return err
}
return nil
}

func (s *seederConfig) seedTRBLeadOptions(ctx context.Context) ([]*models.UserInfo, error) {
leadUsers := map[string]*models.UserInfo{
"ABCD": {
Expand Down Expand Up @@ -888,7 +957,7 @@ func (s *seederConfig) addTRBExistingSystemRelation(
ctx,
s.store,
func(ctx context.Context, systemID string) (*models.CedarSystem, error) {
return &models.CedarSystem{}, nil
return cedarcoremock.GetSystem(systemID), nil
},
models.SetTRBRequestRelationExistingSystemInput{
TrbRequestID: trbRequestID,
Expand Down
52 changes: 30 additions & 22 deletions pkg/dataloaders/dataloaders.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,21 @@ type dataReader struct {
*/
// you can then edit NewDataloaders below to include your new dataloader in the return
type Dataloaders struct {
CedarSystemBookmark *dataloadgen.Loader[models.BookmarkRequest, bool]
CedarSystemLinkedSystemIntakes *dataloadgen.Loader[models.SystemIntakesByCedarSystemIDsRequest, []*models.SystemIntake]
CedarSystemLinkedTRBRequests *dataloadgen.Loader[models.TRBRequestsByCedarSystemIDsRequest, []*models.TRBRequest]
FetchUserInfo *dataloadgen.Loader[string, *models.UserInfo]
GetUserAccount *dataloadgen.Loader[uuid.UUID, *authentication.UserAccount]
GetCedarSystem *dataloadgen.Loader[string, *models.CedarSystem]
SystemIntakeContractNumbers *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeContractNumber]
SystemIntakeSystems *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeSystem]
SystemIntakeGRBReviewers *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeGRBReviewer]
TRBRequestContractNumbers *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestContractNumber]
TRBRequestSystems *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestSystem]
CedarSystemBookmark *dataloadgen.Loader[models.BookmarkRequest, bool]
CedarSystemLinkedSystemIntakes *dataloadgen.Loader[models.SystemIntakesByCedarSystemIDsRequest, []*models.SystemIntake]
CedarSystemLinkedTRBRequests *dataloadgen.Loader[models.TRBRequestsByCedarSystemIDsRequest, []*models.TRBRequest]
FetchUserInfo *dataloadgen.Loader[string, *models.UserInfo]
GetUserAccount *dataloadgen.Loader[uuid.UUID, *authentication.UserAccount]
GetCedarSystem *dataloadgen.Loader[string, *models.CedarSystem]
SystemIntakeContractNumbers *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeContractNumber]
SystemIntakeSystems *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeSystem]
SystemIntakeGRBReviewers *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeGRBReviewer]
SystemIntakeRelatedSystemIntakes *dataloadgen.Loader[uuid.UUID, []*models.SystemIntake]
SystemIntakeRelatedTRBRequests *dataloadgen.Loader[uuid.UUID, []*models.TRBRequest]
TRBRequestContractNumbers *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestContractNumber]
TRBRequestSystems *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestSystem]
TRBRequestRelatedSystemIntakes *dataloadgen.Loader[uuid.UUID, []*models.SystemIntake]
TRBRequestRelatedTRBRequests *dataloadgen.Loader[uuid.UUID, []*models.TRBRequest]
}

// NewDataloaders returns a new set of dataloaders
Expand All @@ -85,16 +89,20 @@ func NewDataloaders(store *storage.Store, fetchUserInfos fetchUserInfosFunc, get
getCedarSystems: getCedarSystems,
}
return &Dataloaders{
CedarSystemBookmark: dataloadgen.NewLoader(dr.batchCedarSystemIsBookmarked),
CedarSystemLinkedTRBRequests: dataloadgen.NewLoader(dr.batchCedarSystemLinkedTRBRequests),
CedarSystemLinkedSystemIntakes: dataloadgen.NewLoader(dr.batchCedarSystemLinkedSystemIntakes),
FetchUserInfo: dataloadgen.NewLoader(dr.fetchUserInfosByEUAUserIDs),
GetUserAccount: dataloadgen.NewLoader(dr.batchUserAccountsByIDs),
GetCedarSystem: dataloadgen.NewLoader(dr.getCedarSystemsByIDs),
SystemIntakeContractNumbers: dataloadgen.NewLoader(dr.batchSystemIntakeContractNumbersBySystemIntakeIDs),
SystemIntakeSystems: dataloadgen.NewLoader(dr.batchSystemIntakeSystemsBySystemIntakeIDs),
SystemIntakeGRBReviewers: dataloadgen.NewLoader(dr.batchSystemIntakeGRBReviewersBySystemIntakeIDs),
TRBRequestContractNumbers: dataloadgen.NewLoader(dr.batchTRBRequestContractNumbersByTRBRequestIDs),
TRBRequestSystems: dataloadgen.NewLoader(dr.batchTRBRequestSystemsByTRBRequestIDs),
CedarSystemBookmark: dataloadgen.NewLoader(dr.batchCedarSystemIsBookmarked),
CedarSystemLinkedTRBRequests: dataloadgen.NewLoader(dr.batchCedarSystemLinkedTRBRequests),
CedarSystemLinkedSystemIntakes: dataloadgen.NewLoader(dr.batchCedarSystemLinkedSystemIntakes),
FetchUserInfo: dataloadgen.NewLoader(dr.fetchUserInfosByEUAUserIDs),
GetUserAccount: dataloadgen.NewLoader(dr.batchUserAccountsByIDs),
GetCedarSystem: dataloadgen.NewLoader(dr.getCedarSystemsByIDs),
SystemIntakeContractNumbers: dataloadgen.NewLoader(dr.batchSystemIntakeContractNumbersBySystemIntakeIDs),
SystemIntakeSystems: dataloadgen.NewLoader(dr.batchSystemIntakeSystemsBySystemIntakeIDs),
SystemIntakeGRBReviewers: dataloadgen.NewLoader(dr.batchSystemIntakeGRBReviewersBySystemIntakeIDs),
SystemIntakeRelatedSystemIntakes: dataloadgen.NewLoader(dr.batchRelatedSystemIntakesBySystemIntakeIDs),
SystemIntakeRelatedTRBRequests: dataloadgen.NewLoader(dr.batchRelatedTRBRequestsBySystemIntakeIDs),
TRBRequestContractNumbers: dataloadgen.NewLoader(dr.batchTRBRequestContractNumbersByTRBRequestIDs),
TRBRequestSystems: dataloadgen.NewLoader(dr.batchTRBRequestSystemsByTRBRequestIDs),
TRBRequestRelatedSystemIntakes: dataloadgen.NewLoader(dr.batchRelatedSystemIntakesByTRBRequestIDs),
TRBRequestRelatedTRBRequests: dataloadgen.NewLoader(dr.batchRelatedTRBRequestsByTRBRequestIDs),
}
}
Loading

0 comments on commit 5518594

Please sign in to comment.