From 3f540de768aa2c8d1b9891b7aadfff856966c9b4 Mon Sep 17 00:00:00 2001 From: seb Date: Mon, 19 Oct 2026 13:25:02 +0200 Subject: [PATCH] u --- src/api/routes/order.js | 10 ++++++++++ src/api/routes/quote.js | 10 ++++++++++ src/api/routes/shipment.js | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/api/routes/order.js b/src/api/routes/order.js index 06d115a..e411cf7 100644 --- a/src/api/routes/order.js +++ b/src/api/routes/order.js @@ -261,6 +261,15 @@ export function register(app, basePath = '') { const onlyUnpaid = req.query.onlyUnpaid === 'true'; const onlyUndelivered = req.query.onlyUndelivered === 'true'; + let entityId = undefined; + if (req.query.entityId !== undefined && req.query.entityId !== '') { + const parsedEntity = parseInt(req.query.entityId, 10); + if (!Number.isInteger(parsedEntity) || parsedEntity <= 0) { + return res.status(400).json({ error: 'entityId must be a positive integer' }); + } + entityId = parsedEntity; + } + let seekMonths = undefined; if (req.query.seekMonths !== undefined && req.query.seekMonths !== '') { const parsedSeek = parseInt(req.query.seekMonths, 10); @@ -277,6 +286,7 @@ export function register(app, basePath = '') { search, onlyUnpaid: onlyUnpaid ? true : undefined, onlyUndelivered: onlyUndelivered ? true : undefined, + entityId, seekMonths, }); res.status(200).json(result); diff --git a/src/api/routes/quote.js b/src/api/routes/quote.js index e98df48..3881d1a 100644 --- a/src/api/routes/quote.js +++ b/src/api/routes/quote.js @@ -245,6 +245,15 @@ export function register(app, basePath = '') { } } + let entityId = undefined; + if (req.query.entityId !== undefined && req.query.entityId !== '') { + const parsedEntity = parseInt(req.query.entityId, 10); + if (!Number.isInteger(parsedEntity) || parsedEntity <= 0) { + return res.status(400).json({ error: 'entityId must be a positive integer' }); + } + entityId = parsedEntity; + } + const search = typeof req.query.search === 'string' && req.query.search.trim() !== '' ? req.query.search.trim() : undefined; @@ -263,6 +272,7 @@ export function register(app, basePath = '') { offset, limit, search, + entityId, seekMonths, }); res.status(200).json(result); diff --git a/src/api/routes/shipment.js b/src/api/routes/shipment.js index 9323941..8aa7569 100644 --- a/src/api/routes/shipment.js +++ b/src/api/routes/shipment.js @@ -265,7 +265,8 @@ export function register(app, basePath = '') { * summary: List shipments * description: | * Company-wide paginated list of shipment manifests (`manifest` rows with `type = 'shipment'`) - * with delivery state, package tracking info, and order references. + * with delivery state, + entityId, package tracking info, and order references. * security: * - cookieAuth: [] * parameters: