Skip to content

feat(api): add GET /api/jobs/:id route to resolve jobs by id with 404 fallback (fixes #13478) - #13479

Open
whyst0ne wants to merge 1 commit into
SecureBananaLabs:mainfrom
whyst0ne:feat/job-detail-by-id-13478
Open

whyst0ne wants to merge 1 commit into
SecureBananaLabs:mainfrom
whyst0ne:feat/job-detail-by-id-13478

Conversation

@whyst0ne

Copy link
Copy Markdown

Overview

Implements GET /api/jobs/:id endpoint to resolve specific jobs by id from the in-memory dataset, returns standard 404 fallback when non-existent, encapsulates the mutable jobs store defensively, and fixes root npm test discovery.

Details of Changes

  1. Service Lookup & Encapsulation (apps/api/src/services/jobService.js):

    • Implements getJobById(id) lookup helper returning the matched job or null.
    • Encapsulates listJobs() with defensive array copy [...jobs].
    • Adds _resetJobs() helper for deterministic test isolation.
  2. Controller (apps/api/src/controllers/jobController.js):

    • Implements getJob controller returning HTTP 200 with job payload or HTTP 404 with standard error body.
    • Wraps controller handlers in try/catch with Express next(err) forwarding.
  3. Routing (apps/api/src/routes/jobRoutes.js):

    • Mounts GET /:id route handler.
  4. Test Discovery Fix (apps/api/package.json):

  5. Automated Unit & Regression Tests (apps/api/src/tests/job_detail.test.js):

    • Resolution of 404 when job does not exist.
    • Creation of job via POST /api/jobs and subsequent retrieval via GET /api/jobs/:id.
    • Verification of backing array immutability.

Fixes #13478
/claim #13478
/claim #11202
/claim #743
/claim #11398

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.

feat(api): add GET /api/jobs/:id route to resolve jobs by id with 404 fallback (ref #743)

1 participant