Skip to content

Adding the unique id into entity and entityType#229

Open
vishwanath1004 wants to merge 7 commits into
ELEVATE-Project:developfrom
vishwanath1004:develop
Open

Adding the unique id into entity and entityType#229
vishwanath1004 wants to merge 7 commits into
ELEVATE-Project:developfrom
vishwanath1004:develop

Conversation

@vishwanath1004
Copy link
Copy Markdown

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e36e1194-b649-4f5e-ae9f-ac30cc71ba7b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Collaborator

@VISHNUDAS-tunerlabs VISHNUDAS-tunerlabs left a comment

Choose a reason for hiding this comment

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

Reviewed May 7 2026

Comment thread src/models/entities.js Outdated
type: String,
index: true,
},
entityUniqueId: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 Lets call this "code" instead "entityUniqueId"

Comment thread src/models/entities.js Outdated
name: 'entities',
schema: {
entityTypeId: 'ObjectId',
entityTypeUniqueId: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 Please rename this variable to entityTypeCode

Comment thread src/models/entities.js Outdated
type: String,
index: true,
},
entityUniqueId: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 Please introduce compoundIndex with code+tenantId

Comment thread src/models/entities.js Outdated
type: String,
index: true,
},
entityUniqueId: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 if this key used as foreignKey anywhere else call it entityCode

Comment thread src/models/entityTypes.js Outdated
name: {
type: String,
},
entityTypeUniqueId: {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 Please rename this to 'code'

Comment thread src/module/entities/helper.js Outdated
childHierarchyPath: childHierarchyPath,
entityType: queryParams.type,
entityType: entityTypeDocument.name || queryParams.type,
entityUniqueId: singleEntity.externalId,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 where ever we used "UniqueId" in variable please replace them with "Code"

Comment thread src/module/entities/helper.js Outdated
childHierarchyPath: childHierarchyPath,
entityType: queryParams.type,
entityType: entityTypeDocument.name || queryParams.type,
entityUniqueId: singleEntity.externalId,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 are we reusing externalId of entity for code?. why can't we use same strategy we used for entityType

Comment thread src/module/entities/helper.js Outdated
entityTypeUniqueId:
entityTypeDocument.entityTypeUniqueId ||
entityTypeUniqueId ||
buildEntityTypeUniqueId(entityTypeDocument.name, tenantId),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 Please rename this function to "generateUniqueCode"

Comment thread src/module/entities/helper.js Outdated
// Retrieve the schema meta information key
let schemaMetaInformation = this.entitiesSchemaData().SCHEMA_METAINFORMATION
let tenantId = req.userDetails.userInformation.tenantId
let tenantId = req.userDetails?.tenantAndOrgInfo?.tenantId || req.userDetails?.userInformation?.tenantId
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 Why are we changing logic of tenant capture?

},
listByEntityType: function () {
req.checkParams('_id').exists().withMessage('required Entity type')
req.checkParams('_id').exists().isMongoId().withMessage('Invalid Entity ID')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vishwanath1004 Why we are removing this?

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.

3 participants