Skip to content

Siri Vavila - feat(api): backend display user skill radar chart data#1861

Open
sirisudheeksha wants to merge 3 commits intodevelopmentfrom
siri_skill_radar_chart_backend
Open

Siri Vavila - feat(api): backend display user skill radar chart data#1861
sirisudheeksha wants to merge 3 commits intodevelopmentfrom
siri_skill_radar_chart_backend

Conversation

@sirisudheeksha
Copy link

Description

This PR implements the backend support for the HGN Questionnaire “User Skill Radar Chart” by adding GET /api/userProfile/:userId/skills-radar, which reads the user’s skill data from the Skills Survey collection, normalizes scores to numbers (0–10), excludes the “overall/Overall” aggregate from the axes, and optionally filters by section via ?section=all|frontend|backend (default all). The controller uses a single optimized query with projection for better performance and returns a compact, chart‑ready payload { userId, section, maxScore: 10, skills: [{ name, score }] }.

Related PRS (if any):

N/A

Main changes explained:

  1. src/controllers/userProfileController.js: Added getUserSkillRadarData. It fetches a user’s skills in one query, drops “overall,” converts scores to numbers (0–10), and supports ?section=all|frontend|backend.
  2. src/routes/userProfileRouter.js: Added GET /api/userProfile/:userId/skills-radar and mapped it to the controller.

How to test:

  1. check into current branch

  2. Install and run:
    npm install
    Option A (dev): npm run dev
    Option B (dist): rm -rf dist && npm run build && npm start

  3. Call the endpoint (replace <USER_ID> with a real id):
    All skills:
    curl -s "http://localhost:4500/api/userProfile/<USER_ID>/skills-radar"
    Frontend only:
    curl -s "http://localhost:4500/api/userProfile/<USER_ID>/skills-radar?section=frontend"
    Backend only:
    curl -s "http://localhost:4500/api/userProfile/<USER_ID>/skills-radar?section=backend"

  4. Verify:
    200 OK
    Response shape:
    { "userId": "<USER_ID>", "section": "all|frontend|backend", "maxScore": ... }
    "overall" not present in skills; scores are numeric.

  5. Optional negative check:
    Unknown userId → 404 "No skill data found for this user"

Screenshots or videos of changes:

Screenshot 2025-10-25 at 8 51 07 PM Screenshot 2025-10-25 at 9 37 37 PM Screenshot 2025-10-25 at 9 37 50 PM ## Note: Include the information the reviewers need to know.

@one-community one-community changed the title feat(api): backend display user skill radar chart data Siri Vavila - feat(api): backend display user skill radar chart data Feb 13, 2026
@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Feb 13, 2026
Copy link

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

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

Hi Siri Vavila,

I have reviewed your PR locally and the API generated responses as expected.

Image Image Image Image

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 7, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants