-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: StatusPlannedActiveOrEnded to ModelBySolutionStatus. Break out into separate resolver, begin unit tests * fix: update snapshot post merging in main * feat: introduce feat with plans that use solutions 4innovations * feat: add more solutions usage to model in seed data * feat: set user view customization for MINT user * feat: update to filter on the frontend using the backend calculated status * feat: add cancelled model plan that uses 4i to seed data for testing * feat: update client test * feaT: rename StatusPlannedActiveOrEnded to ModelBySolutionStatus * feat: add remaining statuses to unit test * Change teset mock property to match query * feat: update cypress homepage setting test to use different user as MINT is seeded with different views * fix: update function name to match gql * feat: add other type to modelBySolutionStatus unit test and update snapshots * feat: add clarifying comment to cypress test --------- Co-authored-by: Patrick Segura <[email protected]>
- Loading branch information
1 parent
891b6c2
commit 2fd0bcc
Showing
17 changed files
with
438 additions
and
749 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,7 @@ func seed(config *viper.Viper) { | |
seeder := newDefaultSeeder(config) | ||
seeder.SeedData() | ||
seeder.CreateAnalyzedAuditData() | ||
seeder.SetDefaultUserViews() | ||
} | ||
|
||
// SeedData gets resolver dependencies and calls wrapped resolver functions to seed data. | ||
|
@@ -110,7 +111,28 @@ func (s *Seeder) SeedData() { | |
} | ||
|
||
// Seed an empty plan | ||
s.createModelPlan("Empty Plan", "MINT") | ||
emptyPlan := s.createModelPlan("Empty Plan", "MINT") | ||
s.updateModelPlan(emptyPlan, map[string]interface{}{ | ||
"abbreviation": "emptyPlan", | ||
"status": models.ModelStatusCanceled, | ||
}) | ||
|
||
emptyPlanOperationalNeeds := s.getOperationalNeedsByModelPlanID(emptyPlan.ID) | ||
if len(emptyPlanOperationalNeeds) < 1 { | ||
panic("operational needs must be populated in order to create an operational solution") | ||
} | ||
|
||
_ = s.addOperationalSolution( | ||
emptyPlan, | ||
emptyPlanOperationalNeeds[0].ID, | ||
map[string]interface{}{ | ||
"needed": false, | ||
"pocName": "The Gump", | ||
"pocEmail": "[email protected]", | ||
"mustStartDts": "2023-02-04T21:39:57.484167Z", | ||
"mustFinishDts": "2023-12-04T21:39:57.484167Z", | ||
}, | ||
) | ||
|
||
// Seed a plan with some information already in it | ||
planWithBasics := s.createModelPlan("Plan with Basics", "MINT") | ||
|
@@ -132,6 +154,27 @@ func (s *Seeder) SeedData() { | |
}, | ||
) | ||
s.existingModelLinkCreate(planWithBasics, models.EMLFTGeneralCharacteristicsResemblesExistingModelWhich, []int{links[3].ID, links[4].ID}, nil) | ||
s.updateModelPlan(planWithBasics, map[string]interface{}{ | ||
"abbreviation": "basics", | ||
"status": models.ModelStatusActive, | ||
}) | ||
|
||
planWithBasicsOperationalNeeds := s.getOperationalNeedsByModelPlanID(planWithBasics.ID) | ||
if len(planWithBasicsOperationalNeeds) < 1 { | ||
panic("operational needs must be populated in order to create an operational solution") | ||
} | ||
|
||
_ = s.addOperationalSolution( | ||
planWithBasics, | ||
planWithBasicsOperationalNeeds[0].ID, | ||
map[string]interface{}{ | ||
"needed": false, | ||
"pocName": "The Gump", | ||
"pocEmail": "[email protected]", | ||
"mustStartDts": "2023-02-04T21:39:57.484167Z", | ||
"mustFinishDts": "2023-12-04T21:39:57.484167Z", | ||
}, | ||
) | ||
|
||
// Seed a plan with collaborators | ||
planWithCollaborators := s.createModelPlan("Plan With Collaborators", "MINT") | ||
|
@@ -145,6 +188,28 @@ func (s *Seeder) SeedData() { | |
TeamRoles: []models.TeamRole{models.TeamRoleLeadership}, | ||
}) | ||
|
||
s.updateModelPlan(planWithCollaborators, map[string]interface{}{ | ||
"abbreviation": "collab", | ||
"status": models.ModelStatusEnded, | ||
}) | ||
|
||
planWithCollaboratorsOperationalNeeds := s.getOperationalNeedsByModelPlanID(planWithCollaborators.ID) | ||
if len(planWithBasicsOperationalNeeds) < 1 { | ||
panic("operational needs must be populated in order to create an operational solution") | ||
} | ||
|
||
_ = s.addOperationalSolution( | ||
planWithCollaborators, | ||
planWithCollaboratorsOperationalNeeds[0].ID, | ||
map[string]interface{}{ | ||
"needed": false, | ||
"pocName": "The Gump", | ||
"pocEmail": "[email protected]", | ||
"mustStartDts": "2023-02-04T21:39:57.484167Z", | ||
"mustFinishDts": "2023-12-04T21:39:57.484167Z", | ||
}, | ||
) | ||
|
||
s.existingModelLinkCreate(planWithCollaborators, models.EMLFTGeneralCharacteristicsResemblesExistingModelWhich, []int{links[4].ID}, nil) | ||
|
||
// Seed a plan with CRs / TDLs | ||
|
@@ -167,13 +232,53 @@ func (s *Seeder) SeedData() { | |
}) | ||
s.existingModelLinkCreate(planWithCrTDLs, models.EMLFTGeneralCharacteristicsResemblesExistingModelWhich, nil, []uuid.UUID{planWithCollaborators.ID, planWithBasics.ID}) | ||
|
||
s.updateModelPlan(planWithCrTDLs, map[string]interface{}{ | ||
"abbreviation": "crTDLPlan", | ||
"status": models.ModelStatusAnnounced, | ||
}) | ||
|
||
planWithCrTDLsOperationalNeeds := s.getOperationalNeedsByModelPlanID(planWithCrTDLs.ID) | ||
if len(planWithCrTDLsOperationalNeeds) < 1 { | ||
panic("operational needs must be populated in order to create an operational solution") | ||
} | ||
|
||
_ = s.addOperationalSolution( | ||
planWithCrTDLs, | ||
planWithCrTDLsOperationalNeeds[0].ID, | ||
map[string]interface{}{ | ||
"needed": false, | ||
"pocName": "The Gump", | ||
"pocEmail": "[email protected]", | ||
"mustStartDts": "2023-02-04T21:39:57.484167Z", | ||
"mustFinishDts": "2023-12-04T21:39:57.484167Z", | ||
}, | ||
) | ||
|
||
// Seed a plan that is already archived | ||
archivedPlan := s.createModelPlan("Archived Plan", "MINT") | ||
s.updateModelPlan(archivedPlan, map[string]interface{}{ | ||
"archived": true, | ||
"abbreviation": "arch", | ||
"status": models.ModelStatusPaused, | ||
}) | ||
|
||
archivedPlanOperationalNeeds := s.getOperationalNeedsByModelPlanID(archivedPlan.ID) | ||
if len(archivedPlanOperationalNeeds) < 1 { | ||
panic("operational needs must be populated in order to create an operational solution") | ||
} | ||
|
||
_ = s.addOperationalSolution( | ||
archivedPlan, | ||
archivedPlanOperationalNeeds[0].ID, | ||
map[string]interface{}{ | ||
"needed": false, | ||
"pocName": "The Gump", | ||
"pocEmail": "[email protected]", | ||
"mustStartDts": "2023-02-04T21:39:57.484167Z", | ||
"mustFinishDts": "2023-12-04T21:39:57.484167Z", | ||
}, | ||
) | ||
|
||
// Seed a plan with some documents | ||
planWithDocuments := s.createModelPlan("Plan with Documents", "MINT") | ||
restrictedDocument := s.planDocumentCreate(planWithDocuments, "File (Unscanned)", "cmd/dbseed/data/sample.pdf", "application/pdf", models.DocumentTypeConceptPaper, true, nil, nil, false, false) | ||
|
@@ -308,3 +413,12 @@ func (s *Seeder) CreateAnalyzedAuditData() { | |
} | ||
|
||
} | ||
|
||
func (s *Seeder) SetDefaultUserViews() { | ||
mintPrinc := s.getTestPrincipalByUsername("MINT") | ||
s.updateUserView(mintPrinc, map[string]interface{}{ | ||
"viewCustomization": []models.ViewCustomizationType{models.ViewCustomizationTypeModelsByOperationalSolution, models.ViewCustomizationTypeFollowedModels, models.ViewCustomizationTypeAllModelPlans}, | ||
"possibleOperationalSolutions": []models.OperationalSolutionKey{models.OpSKInnovation, models.OpSKAcoOs}, | ||
}, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.