Bosu - fix: expose user profile id in HGN questionnaire responses - #2315
Open
BosuBose132 wants to merge 1 commit into
Open
Bosu - fix: expose user profile id in HGN questionnaire responses#2315BosuBose132 wants to merge 1 commit into
BosuBose132 wants to merge 1 commit into
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes the backend identifier mismatch affecting HGN Questionnaire Dashboard profile navigation.
The HGN ranked and community endpoints return records from
HGNFormResponses. Their existing_idfield represents the questionnaire response document ID, while/api/skills/profile/:userIdexpects the correspondingUserProfile._id.Because the actual profile ID was not exposed by the ranked/community responses, the frontend was previously navigating with the questionnaire response
_id. The profile endpoint could not resolve that value as a user profile and returned placeholder data such asUnknown User.This PR preserves the existing
_idfield and adds the associateduser_idvalue asuserIdto the relevant API responses.Related PRs
userIdfield for/hgnhelp/profile/:userId.Main changes explained
Updated
hgnFormResponseController.jsranked responses to preserve:_id: user._idand additionally expose:
userId: user.user_idUpdated
communityController.jsto preserve:_id: member._idand additionally expose:
userId: member.user_idPreserved all existing response fields and behavior for backward compatibility.
Added focused assertions to the existing HGN form response controller tests.
Added focused tests for the community controller response.
No database schema, route, or user skills profile controller changes were made.
How to test
Checkout this backend branch.
Checkout the related frontend PR branch.
Run:
npm run buildStart the backend locally.
Start the related frontend locally.
Navigate to the HGN questionnaire community member list.
Inspect the ranked/community API response in DevTools.
Verify each applicable user object contains both:
_id— questionnaire response document IDuserId— actual user profile IDClick a user's name in the frontend.
Verify the frontend uses
userIdwhen navigating to:/hgnhelp/profile/<userId>Verify the subsequent request to:
/api/skills/profile/<userId>returns the real user profile instead of placeholder
Unknown Userdata.Test multiple users and verify skills, experience, and team information are returned when available.
Validation performed
git diff --check: passednpm run build: passedScreenshots or videos of changes
Note
This is an additive and backward-compatible response change. The existing
_idfield remains unchanged because other functionality may depend on the questionnaire response document ID. No schema, database migration, route, or unrelated controller changes are included.