-
Notifications
You must be signed in to change notification settings - Fork 19
Related org #794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Related org #794
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -410,7 +410,8 @@ module.exports = class OrganizationsHelper { | |||||||||||||||||||||||||
| if (tenantCode.trim()) filter.tenant_code = tenantCode | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const organisationDetails = await organizationQueries.findOne(filter) | ||||||||||||||||||||||||||
| const organisationDetails = await organizationQueries.findOne(filter, { getRelatedOrgIdAndCode: true }) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (!organisationDetails) { | ||||||||||||||||||||||||||
| return responses.failureResponse({ | ||||||||||||||||||||||||||
| message: 'ORGANIZATION_NOT_FOUND', | ||||||||||||||||||||||||||
|
|
@@ -419,6 +420,15 @@ module.exports = class OrganizationsHelper { | |||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // if(organisationDetails.related_orgs && organisationDetails.related_orgs.length >0){ | ||||||||||||||||||||||||||
| // let orgFilters = {id:{[Op.in]:organisationDetails.related_orgs}} | ||||||||||||||||||||||||||
| // const relatedOrgsIdAndCode = await organizationQueries.findAll(orgFilters) | ||||||||||||||||||||||||||
| // organisationDetails.relatedOrgsIdAndCode = relatedOrgsIdAndCode.map(eachOrg => ({ | ||||||||||||||||||||||||||
| // id: eachOrg.id, | ||||||||||||||||||||||||||
| // code: eachOrg.code | ||||||||||||||||||||||||||
| // })); | ||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||
|
Comment on lines
+423
to
+430
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainConsider activating the related organizations population logic. The commented-out block contains logic to populate Let me check if the query layer's 🏁 Script executed: #!/bin/bash
# Description: Verify if the relatedOrgsDetails include in queries provides the same functionality as the commented code
# Check the query implementation for relatedOrgsDetails
rg -A 10 -B 5 "getRelatedOrgIdAndCode"
# Look for any tests that might show expected behavior
fd -e js test | xargs grep -l "relatedOrgs\|related_orgs" | head -3Length of output: 2752 🏁 Script executed: #!/bin/bash
# Show context around the commented block in src/services/organization.js
rg -n "related_orgs" -C5 src/services/organization.jsLength of output: 3071 Remove redundant related-orgs population logic The const organisationDetails = await organizationQueries.findOne(filter, { getRelatedOrgIdAndCode: true })
-// if(organisationDetails.related_orgs && organisationDetails.related_orgs.length >0){
-// let orgFilters = {id:{[Op.in]:organisationDetails.related_orgs}}
-// const relatedOrgsIdAndCode = await organizationQueries.findAll(orgFilters)
-// organisationDetails.relatedOrgsIdAndCode = relatedOrgsIdAndCode.map(eachOrg => ({
-// id: eachOrg.id,
-// code: eachOrg.code
-// }));
-//}
+// If you still need the old field name, uncomment below:
+// organisationDetails.relatedOrgsIdAndCode = organisationDetails.relatedOrgsDetails• File: src/services/organization.js 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return responses.successResponse({ | ||||||||||||||||||||||||||
| statusCode: httpStatusCode.ok, | ||||||||||||||||||||||||||
| message: 'ORGANIZATION_FETCHED_SUCCESSFULLY', | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the conditional logic in db:init script.
The current script has incorrect operator precedence. Due to
&&having higher precedence than||, migrations will only run whendb:createfails, not when it succeeds.Apply this diff to fix the logic:
📝 Committable suggestion
🤖 Prompt for AI Agents