This commit is contained in:
seb
2026-10-15 10:50:03 +02:00
parent f331625d63
commit 529b142341
13 changed files with 82 additions and 34 deletions

View File

@@ -171,6 +171,10 @@ export function register(app, basePath = '') {
* type: integer
* nullable: true
* description: Customer entity (manifest.entity_id)
* externalNumber:
* type: string
* nullable: true
* description: External customer reference number (manifest.external_number)
* lines:
* type: array
* items:
@@ -292,7 +296,7 @@ export function register(app, basePath = '') {
return res.status(400).json({ error: selected.error });
}
const { number, date, createdAt, entityId, lines } = req.body ?? {};
const { number, date, createdAt, entityId, externalNumber, lines } = req.body ?? {};
if (entityId !== undefined && entityId !== null && (typeof entityId !== 'number' || !Number.isInteger(entityId) || entityId <= 0)) {
return res.status(400).json({ error: 'Invalid entityId' });
}
@@ -303,6 +307,7 @@ export function register(app, basePath = '') {
date,
createdAt,
entityId,
externalNumber: externalNumber !== undefined && externalNumber !== null ? String(externalNumber) : externalNumber,
lines,
});
res.status(201).json({ order });
@@ -397,6 +402,10 @@ export function register(app, basePath = '') {
* entityId:
* type: integer
* nullable: true
* externalNumber:
* type: string
* nullable: true
* description: External customer reference number (manifest.external_number)
* lines:
* type: array
* items:
@@ -534,6 +543,11 @@ export function register(app, basePath = '') {
}
patch.entityId = body.entityId;
}
if (Object.prototype.hasOwnProperty.call(body, 'externalNumber')) {
patch.externalNumber = body.externalNumber !== null && body.externalNumber !== undefined
? String(body.externalNumber)
: null;
}
if (Object.prototype.hasOwnProperty.call(body, 'lines')) {
patch.lines = body.lines;
}