BE29 : feat(support): consolidate contact, FAQ, feedback, health-tools#252
Merged
TienNguyen3711 merged 5 commits intoMay 10, 2026
Merged
Conversation
Collaborator
|
I tested this by merging Result:
Actual code issue introduced/exposed after merge
Multiple integration/API test failures
Empty/incompatible test suite
Conclusion:
Please fix the post-merge test/runtime issues before this is considered safe to merge. |
Collaborator
|
Good PR, and progress, Address the concerns of Tien after that we can merge. |
…nd loginService - recommendationService.js: removed duplicate generateRecommendations stub - loginService.js: completed mangled login() return + removed orphaned buildJwt that was breaking ~8 auth test suites with SyntaxError - POST_MERGE_FIXES.md: documented round-2 reviewer feedback fixes
TienNguyen3711
approved these changes
May 10, 2026
Collaborator
TienNguyen3711
left a comment
There was a problem hiding this comment.
Everything works well. Approved
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.
Summary
Consolidates the support-related backend (Contact Us, Feedback, Chatbot, FAQ, Health Tools) behind a single response envelope, ships a working email pipeline for Contact Us, and resolves the blank
/health-faqand/health-toolsfrontend pages by giving them backend endpoints with seed-data fallbacks so they are never empty.Closes the support consolidation epic.
Why
/health-faqand/health-toolsrendered blank because the backend exposed no list endpoints (onlyGET /api/health-tools/bmi).routes/index.jshad two duplicate route registrations (/api/chatbotand/api/upload).What's in this PR
Live Contact Us email flow
utils/emailService.jswraps Nodemailer with SMTP env vars (SMTP_HOST,SMTP_PORT,SMTP_SECURE,SMTP_USER,SMTP_PASS,SUPPORT_EMAIL,MAIL_FROM).jsonTransportand logs a warning — so dev and CI never crash and tests stay hermetic.Reply-Toset to the user)FAQ + Health Tools (no more blank pages)
GET /api/faq(with optional?category=) — reads from thefaqSupabase table when present, falls back to bundled seed FAQs (controller/supportData/faqSeed.js) when the table is missing, empty, or errors.GET /api/health-tools— returns the tool catalogue fromcontroller/supportData/healthToolsSeed.jsso the frontend page always has something to render.GET /api/health-tools/bmiupgraded with BMI category, water-intake estimate, and input range validation.Standardized response envelope
utils/supportResponse.js— thin helper aroundservices/apiResponseServicethat emits{ success, data, meta }for success and{ success, error: { message, code, details? } }for errors across all support endpoints.details.fieldsarray instead of raw express-validator output.Tighter validation
validators/contactusValidator.js: min lengths on name/subject/message, email length cap, andnormalizeEmail().Tests (15 / 15 passing)
test/contactus.controller.test.js— validation envelope, persistence success, persistence failure, email failure degradationtest/userFeedback.controller.test.js— happy path + persistence failuretest/faq.controller.test.js— seed fallback (empty rows / DB error), DB rows when present, category filtertest/healthTools.controller.test.js— catalogue, category filter, BMI invalid input, BMI out-of-range, BMI happy pathCleanup
routes/index.js: removed the duplicate/api/chatbotand/api/uploadmounts; grouped the support surface together.validateRequestmiddleware fromroutes/contactus.jsandroutes/userfeedback.js(the controllers now own validation handling and emit the standardized envelope).API surface
No existing routes were removed. No breaking changes to existing API consumers — the chatbot, recipe, auth, etc. surfaces are untouched.
Response envelope examples
Success (
POST /api/contactus):Validation error:
Server error:
Files
New
Modified
Configuration
Add the following to
.env(already documented in.env.example):If these are left blank, the service falls back to a no-op JSON transport — the Contact Us form will still return
201and persist the message, but no email will be delivered.data.email.smtpConfigured: falseis returned in the response envelope so this state is observable.How to test locally
Run the new test suites:
Risks / rollout
POST /api/contactuswill see the success response shape change from{ success: true, data: null, meta: { message } }to{ success: true, data: { received: true, email: {...} }, meta: { message } }. Frontend should ignore unknown keys, but worth a smoke test.faqSupabase table is read-only; if it doesn't exist the controller falls back to the bundled seed.warnlevel and surfaced asdata.email.supportNotified: false. Add an alert on that signal if you want hard guarantees.Definition of Done — checklist