Skip to content

Conversation

@MallanagoudaB
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@priyanka-TL priyanka-TL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on May 30th 5.41 PM

Copy link
Collaborator

@priyanka-TL priyanka-TL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on May 30th 5.41 PM

Copy link
Collaborator

@priyanka-TL priyanka-TL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on May 30th 5.41 PM

Copy link
Collaborator

@priyanka-TL priyanka-TL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed on May 30th 5.41 PM

childHierarchyPath = validatedChildHierarchy.map(String)
}

if (singleEntity['targetedEntityTypes']) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prajwal17Tunerlabs Can we optimize this
singleEntity.targetedEntityTypes = Array.isArray(singleEntity.targetedEntityTypes)
? await populateTargetedEntityTypesData(
singleEntity.targetedEntityTypes.map(item => item.trim()),
tenantId
)
: []

return entityMetaInformation
}

async function populateTargetedEntityTypesData(targetedEntityTypes, tenantId) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Prajwal17Tunerlabs add it in try catch also using object destructuring
somethin g like below
async function populateTargetedEntityTypesData(targetedEntityTypes, tenantId) {
try {
const entityTypes = await entityTypeQueries.entityTypesDocument(
{ name: { $in: targetedEntityTypes }, tenantId },
['name', '_id']
)

	return entityTypes.map(({ _id, name }) => ({
		entityTypeId: _id.toString(),
		entityType: name,
	}))
} catch (error) {
	console.error('Error populating targeted entity types:', error)
	return [] // or throw error if you want to bubble it up
}

}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code updated as suggested

@priyanka-TL priyanka-TL merged commit 628f20c into develop Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants