func PopulateCommonTypes(ctx context.Context, db *gorm.DB, witr *workitem.GormWorkItemTypeRepository) error {
	populateLocker.Lock()
	defer populateLocker.Unlock()
	if err := createSpace(ctx, space.NewRepository(db), space.SystemSpace, "The system space is reserved for spaces that can to be manipulated by the user."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateSystemPlannerItemType(ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	workitem.ClearGlobalWorkItemTypeCache() // Clear the WIT cache after updating existing WITs
	if err := createOrUpdatePlannerItemExtension(workitem.SystemUserStory, "User Story", "Desciption for User Story", "fa-map-marker", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemValueProposition, "Value Proposition", "Description for value proposition", "fa-gift", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemFundamental, "Fundamental", "Description for Fundamental", "fa-bank", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemExperience, "Experience", "Description for Experience", "fa-map", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemScenario, "Scenario", "Description for Scenario", "fa-adjust", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemFeature, "Feature", "Description for Feature", "fa-mouse-pointer", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemBug, "Bug", "Description for Bug", "fa-bug", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	workitem.ClearGlobalWorkItemTypeCache() // Clear the WIT cache after updating existing WITs
	return nil
}
// PopulateCommonTypes makes sure the database is populated with the correct types (e.g. bug etc.)
PopulateCommonTypes makes sure the database is populated with the correct types
// PopulateCommonTypes makes sure the database is populated with the correct types ( e . g . bug etc . )
func PopulateCommonTypes(ctx context.Context, db *gorm.DB, witr *workitem.GormWorkItemTypeRepository) error {
	populateLocker.Lock()
	defer populateLocker.Unlock()
	if err := createSpace(ctx, space.NewRepository(db), space.SystemSpace, "The system space is reserved for spaces that can to be manipulated by the user."); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdateSystemPlannerItemType(ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	workitem.ClearGlobalWorkItemTypeCache() 
	if err := createOrUpdatePlannerItemExtension(workitem.SystemUserStory, "User Story", "Desciption for User Story", "fa-map-marker", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemValueProposition, "Value Proposition", "Description for value proposition", "fa-gift", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemFundamental, "Fundamental", "Description for Fundamental", "fa-bank", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemExperience, "Experience", "Description for Experience", "fa-map", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemScenario, "Scenario", "Description for Scenario", "fa-adjust", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemFeature, "Feature", "Description for Feature", "fa-mouse-pointer", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	if err := createOrUpdatePlannerItemExtension(workitem.SystemBug, "Bug", "Description for Bug", "fa-bug", ctx, witr, db, space.SystemSpace); err != nil {
		return errs.WithStack(err)
	}
	workitem.ClearGlobalWorkItemTypeCache() 
	return nil
}
func PopulateCommonTypes ( ctx context . Context , db * gorm . DB , witr * workitem . GormWorkItemTypeRepository ) error { populateLocker . Lock ( ) defer populateLocker . Unlock ( ) if err := createSpace ( ctx , space . NewRepository ( db ) , space . SystemSpace , " " ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdateSystemPlannerItemType ( ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } workitem . ClearGlobalWorkItemTypeCache ( ) if err := createOrUpdatePlannerItemExtension ( workitem . SystemUserStory , " " , " " , " " , ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdatePlannerItemExtension ( workitem . SystemValueProposition , " " , " " , " " , ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdatePlannerItemExtension ( workitem . SystemFundamental , " " , " " , " " , ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdatePlannerItemExtension ( workitem . SystemExperience , " " , " " , " " , ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdatePlannerItemExtension ( workitem . SystemScenario , " " , " " , " " , ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdatePlannerItemExtension ( workitem . SystemFeature , " " , " " , " " , ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } if err := createOrUpdatePlannerItemExtension ( workitem . SystemBug , " " , " " , " " , ctx , witr , db , space . SystemSpace ) ; err != nil { return errs . WithStack ( err ) } workitem . ClearGlobalWorkItemTypeCache ( ) return nil }
PopulateCommonTypes makes sure the database is populated with the correct types
PopulateCommonTypes makes sure the database is populated with the correct types
// Clear the WIT cache after updating existing WITs // Clear the WIT cache after updating existing WITs