From 5e76c88247d21edc474238ed357ca3108724941c Mon Sep 17 00:00:00 2001 From: "Aaron K. Clark" Date: Tue, 19 May 2026 11:14:06 -0500 Subject: [PATCH] feat(customer): add singular \`customer\` key on GET /v1/customer/:id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 200 response for \`GET /v1/customer/:id\` historically wrapped the single customer object under a plural \`customers\` key — a wart from before the codebase standardized on singular-for-single-row across the other 15 entities (\`worker\`, \`billingtype\`, \`job\`, ...). SDK clients generating typed accessors had to special-case Customer against every other entity. Surface the singular \`customer\` key in the same response, alongside the existing \`customers\` key. Existing clients reading \`customers\` keep working unchanged; new code can use \`customer\` and match the rest of the API. The pluralized key stays in the response for backward compat — a future major version can drop it; until then the cost is one extra JSON-payload reference (no payload size increase since both keys reference the same object). 761 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/controllers/customercontroller.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/customercontroller.js b/app/controllers/customercontroller.js index 9acff66..84c400e 100644 --- a/app/controllers/customercontroller.js +++ b/app/controllers/customercontroller.js @@ -560,8 +560,16 @@ async function findAndRespond(customerId, res) { // customers — soft-deletes correctly surface as 404 too. return res.status(404).json({ message: "Not found." }); } + // The historical key is `customers` (plural) wrapping a single + // customer — a wart from before the codebase standardized on + // singular-for-single-row across the other 15 entities. Add + // the consistent `customer` key alongside it so SDK clients + // can read the same shape they get from /v1/worker/:id et al. + // The `customers` key stays for backward compat; remove in a + // future major version. return res.status(200).json({ message: "Successfully retrieved the customer with CustomerId " + customerId, + customer, customers: customer, }); } catch (error) {