Skip to content

Sayali: add test endpoint for setting user teamCode#2060

Open
sayali-2308 wants to merge 1 commit intodevelopmentfrom
Sayali_Add_Member_Count_To_PR_Actions_Chart
Open

Sayali: add test endpoint for setting user teamCode#2060
sayali-2308 wants to merge 1 commit intodevelopmentfrom
Sayali_Add_Member_Count_To_PR_Actions_Chart

Conversation

@sayali-2308
Copy link
Contributor

@sayali-2308 sayali-2308 commented Feb 19, 2026

image

Description

Adds a test endpoint to support testing of Task #14 (PRIORITY MEDIUM): Show the number of team members next to team name in 'PR Action Done' bar charts.

This endpoint allows testers to assign a teamCode to a user profile without needing direct MongoDB access, enabling verification that member counts update correctly in the PR Action Done chart.

Implements # 14 (Priority Medium - PR Review Team Analytics Dashboard - PR Insights Frontend)

Related PRs (if any):

This backend PR is related to the frontend PR OneCommunityGlobal/HighestGoodNetworkApp#4864
To test this backend PR you need to checkout the frontend PR Sayali_Add_Member_Count_To_PR_Actions_Chart.

Main changes explained:

  • Created src/routes/testRoutes.js — adds a POST endpoint /api/test/set-team-code that updates a user's teamCode field by userId, used for testing member count display in the PR Action Done chart
  • Updated src/app.js to register the test route

How to test:

  1. Check out current branch: Sayali_Add_Member_Count_To_PR_Actions_Chart
  2. Run npm run build and npm run start to run the backend locally
  3. Get auth token via Postman:
    • POST http://localhost:4500/api/login
    • Body: { "email": "devadmin@hgn.net", "password": "#############" }
  4. Get a valid userId:
    • GET http://localhost:4500/api/userprofile with Bearer token
    • Copy any _id from the response
  5. Call the test endpoint:
    • POST http://localhost:4500/api/test/set-team-code
    • Body: { "userId": "<copied_id>", "teamCode": "Team E" }
  6. Verify response returns success: true with updated user showing teamCode: "Team E"
  7. Now check the frontend PR — Team E should show in the PR Action Done chart after hard refresh

Screenshots or videos of changes:

Get userprofile

image

Set-team-code

image

Check pr-review-insights

image image image

Note:

  • This endpoint is intended for testing purposes only to help testers verify the member count feature without requiring direct MongoDB access.
  • The endpoint requires a valid auth token to access.

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.

1 participant

Comments