Skip to content

Bosu - hgn questionnaire followup fixes backend - #2316

Open
BosuBose132 wants to merge 3 commits into
developmentfrom
Bosu-HGN-Questionnaire-Followup-Fixes-Backend
Open

Bosu - hgn questionnaire followup fixes backend#2316
BosuBose132 wants to merge 3 commits into
developmentfrom
Bosu-HGN-Questionnaire-Followup-Fixes-Backend

Conversation

@BosuBose132

Copy link
Copy Markdown
Contributor

Description

Adds backend support for the HGN Questionnaire Dashboard follow-up requirement to display forms on /hgnform with their formName and description.

The existing generic Form schema supported formName and questions but did not include a description field. This PR adds backward-compatible description support to the existing Form model and updates the form controller so descriptions can be preserved and returned through the existing form API.

Existing Form records without descriptions remain valid, and the existing HGN question API and questionnaire response flow are unchanged.

Fixes # PR #1547 / PR #3775 follow-up fixes

Related PRS (if any):

  • This backend PR is related to the #5463 frontend PR.
  • To test this backend PR you need to checkout the frontend branch:
    Bosu-HGN-Questionnaire-Followup-Fixes
  • This is follow-up work related to backend PR shashank-madan HGN Questionnaire Dashboard: Backend #1547.
  • The original related frontend implementation was PR #3775.

Main changes explained:

  • Update src/models/forms.js to support an optional description field for generic forms.
  • Keep description backward compatible so existing database records without this field continue to work.
  • Update src/controllers/formController.js so form creation and editing preserve description metadata.
  • Keep the existing /api/form response behavior while allowing returned forms to include description.
  • Update src/controllers/formController.spec.js with focused coverage for the new description behavior.
  • Resolve lint issues in the touched controller and test files required by the repository pre-commit checks without changing application behavior.
  • Preserve the existing /api/questions HGN questionnaire API and existing form-response behavior.

How to test:

  1. Checkout the current backend branch:
    Bosu-HGN-Questionnaire-Followup-Fixes-Backend
  2. Checkout the related frontend branch:
    Bosu-HGN-Questionnaire-Followup-Fixes
  3. Run npm install if dependencies need to be installed.
  4. Run:
    npm run build
  5. Start the backend with:
    npm start
  6. Start the frontend with:
    npm run start:local
  7. Clear site data/cache and log in with a valid development account.
  8. Navigate to /hgnform.
  9. Verify forms returned from the existing /api/form endpoint are displayed.
  10. Verify forms with a stored description return and display the description.
  11. Verify existing forms without descriptions still load normally.
  12. Verify the HGN Development Team Questionnaire can still be opened and completed.
  13. Verify the existing /api/questions flow continues to work.
  14. Verify the related frontend feature works in [dark mode](https://docs.google.com/document/d/11OXJfBBedK6vV-XvqWR8A9lOH0BsfnaHx01h1NZZXfI).

Screenshots or videos of changes:

Screenshot 2026-08-22 at 3 50 22 PM ![Uploading Screenshot 2026-08-22 at 3.50.31 PM.png…]()

Note:

  • Focused backend tests passed: 9/9.
  • Backend build passed and compiled 301 files.
  • Husky pre-commit checks passed.
  • git diff --check passed.
  • The new description field is optional, so no MongoDB migration or manual update is required for existing Form records.
  • No existing HGN questionnaire routes, permission logic, or form-response behavior were changed.

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.

2 participants