u
This commit is contained in:
@@ -48,6 +48,9 @@ function parseDeliveryPayload(req) {
|
||||
}
|
||||
|
||||
const { externalNumber, date, createdAt, supplierId, lines } = payload;
|
||||
if (supplierId !== undefined && supplierId !== null && (typeof supplierId !== 'number' || !Number.isInteger(supplierId) || supplierId <= 0)) {
|
||||
throw new Error('Invalid supplierId');
|
||||
}
|
||||
let files = payload.files;
|
||||
// If binary files were uploaded via multer:
|
||||
if (Array.isArray(req.files) && req.files.length > 0) {
|
||||
@@ -161,6 +164,7 @@ function deliveryErrorStatus(error) {
|
||||
if (error.message === 'Attachment not found') return 404;
|
||||
if (error.message === 'File not found') return 404;
|
||||
if (error.message === 'Supplier not found') return 404;
|
||||
if (error.message === 'Invalid supplierId') return 400;
|
||||
if (error.message === 'Article not found') return 404;
|
||||
if (error.message === 'Invalid delivery') return 400;
|
||||
if (error.message === 'Invalid lines') return 400;
|
||||
|
||||
Reference in New Issue
Block a user