Purav-taking-over-job-form-issues-backend - #2333
Open
pixelpix13 wants to merge 3 commits into
Open
Conversation
…ositions list Give the job application page backend support on current development so applicants can submit without a JWT, resume uploads and confirmation emails are stored or sent, and the dropdown loads distinct job titles.
…oads The live form posts a payload JSON body plus questionFile_* fields, which multer.single(resume) rejected before save. Accept any multipart files so resume and second uploads are stored.
Extract answer-building and email helpers to satisfy Sonar cognitive complexity, and add coverage for invalid payload, save failures, and failed question-file uploads.
pixelpix13
force-pushed
the
Purav-job-form-issues-backend
branch
from
September 3, 2026 20:09
fb9a22f to
64c0a1d
Compare
|
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
This PR takes over and finishes the backend work for the Job Application Page (
/job-application) form fixes (Priority High). It supersedes the original backend PR #2318 by rebasing the feature onto currentdevelopmentand adding fixes found during live testing.Paired frontend PR (required for end-to-end testing): OneCommunityGlobal/HighestGoodNetworkApp#5502 — branch
Purav-fix-job-application-form-issuesApplicants can submit applications without a JWT, duplicate emails are blocked per form, confirmation emails are sent (non-fatal), resumes and per-question file uploads are stored in Azure (non-fatal), and the job title dropdown loads distinct titles from the jobs collection.
Related PRs
Purav-job-form-issues-backenddevelopmentjob-form-issues-backendPurav-fix-job-application-form-issuesfix-job-form-issues-frontendTo test end-to-end: check out
Purav-job-form-issues-backendon HGNRest andPurav-fix-job-application-form-issueson HighestGoodNetworkApp (#5502).What changed vs the old PR (#2318)
development(not a direct merge ofjob-form-issues-backend, which was behind and would have overwritten newer job-form admin code)pr-gradingcommits andpackage-lock.jsonchurn were excludedpayloadJSON body plusquestionFile_*multipart fields (resume + second upload). Switched fromupload.single('resume')toupload.any()and added payload parsing so cover-letter uploads no longer causeMulterError: Unexpected field/ 500Main changes explained
jobApplicationsModel.js— addedemailandresumeUrlfields for duplicate detection and resume storagejobsController.js— addedgetActiveJobPositions(Job.distinct('title'), sorted alphabetically)jobsRouter.js—/positions→ active job titles; oldgetPositions(JobPositionCategory) moved to/position-categories; route ordering preservedcollaborationController.js— addedsubmitFormResponse: 400 on missing fields, 404 if form not found, 409 on duplicate email, optional Azure resume + question-file uploads (non-fatal), confirmation email viaemailSender(non-fatal), 201 on success; accepts both flat fields andpayloadJSON from the live frontendcollaborationRouter.js—POST /jobforms/:formId/responseswithupload.any()middlewaremiddleware.js— public exemptions forGET /api/jobforms/all,GET /api/jobforms/:id, andPOST /api/jobforms/:id/responsescollaborationController.test.js(new) andjobsController.test.js(getActiveJobPositions)How to test
Purav-job-form-issues-backendon HGNRest andPurav-fix-job-application-form-issueson HighestGoodNetworkApp (#5502)npm installif needed on both reposnpm run buildthennpm start(HGNRest, default port 4500)npm run start:local→ http://localhost:5173/job-application) — no login required for applicantsGET /api/jobs/positions→{ positions: ["Title A", ...] }POST /api/jobforms/:formId/responseswithout JWT → 201formId→ 404; missing email → 400npm test -- src/controllers/collaborationController.test.js src/controllers/jobsController.test.jsScreenshots or videos of changes
pr_5502_2333_video.mp4
Note
Purav-fix-job-application-form-issues). Older backend/frontend pairs (Purav taking over for Sohail - Job form issues backend #2318 / #5469) will 500 on second file upload.sendEmailis enabled; local dev typically returnsEMAIL_SENDING_DISABLED_NON_PROD