Skip to content

Commit

Permalink
update uuid.Nil reference for special placeholder reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed Oct 18, 2023
1 parent 9327464 commit 145eea6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/pkg/database/gorm_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func (gr *GormRepository) AddResourceComposition(ctx context.Context, compositio
}

//generate placeholder source
placeholderSource := models.SourceCredential{UserID: currentUser.ID, SourceType: "manual", ModelBase: models.ModelBase{ID: uuid.MustParse("00000000-0000-0000-0000-000000000000")}}
placeholderSource := models.SourceCredential{UserID: currentUser.ID, SourceType: "manual", ModelBase: models.ModelBase{ID: uuid.Nil}}

existingCompositionResources := []*models.ResourceBase{}
rawResourceLookupTable := map[string]*models.ResourceBase{}
Expand Down
2 changes: 1 addition & 1 deletion backend/pkg/database/gorm_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ func (suite *RepositoryTestSuite) TestAddResourceComposition_WithExistingComposi

//assert that the associations were created
associations, err := dbRepo.FindResourceAssociationsByTypeAndId(authContext,
&models.SourceCredential{UserID: userModel.ID, ModelBase: models.ModelBase{ID: uuid.MustParse("00000000-0000-0000-0000-000000000000")}}, //Compositions have a unique/placeholder credential ID
&models.SourceCredential{UserID: userModel.ID, ModelBase: models.ModelBase{ID: uuid.Nil}}, //Compositions have a unique/placeholder credential ID
"Composition", compositions[0].SourceResourceID)
require.NoError(suite.T(), err)
require.Equal(suite.T(), 5, len(associations))
Expand Down

0 comments on commit 145eea6

Please # to comment.