This commit is contained in:
seb
2026-10-19 13:25:02 +02:00
parent 3450552f7c
commit 3f540de768
3 changed files with 22 additions and 1 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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: