From 145eea6d6a43537f00eb320c0e1743b7923a656b Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Tue, 17 Oct 2023 20:25:23 -0700 Subject: [PATCH] update uuid.Nil reference for special placeholder reference. --- backend/pkg/database/gorm_common.go | 2 +- backend/pkg/database/gorm_repository_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/pkg/database/gorm_common.go b/backend/pkg/database/gorm_common.go index 4b006b665..3863da820 100644 --- a/backend/pkg/database/gorm_common.go +++ b/backend/pkg/database/gorm_common.go @@ -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{} diff --git a/backend/pkg/database/gorm_repository_test.go b/backend/pkg/database/gorm_repository_test.go index c67ffeffd..53d0816d4 100644 --- a/backend/pkg/database/gorm_repository_test.go +++ b/backend/pkg/database/gorm_repository_test.go @@ -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))