u
This commit is contained in:
@@ -47,7 +47,7 @@ function parseDeliveryPayload(req) {
|
||||
throw new Error('Invalid delivery');
|
||||
}
|
||||
|
||||
const { externalNumber, date, supplierId, lines } = payload;
|
||||
const { externalNumber, date, createdAt, supplierId, lines } = payload;
|
||||
let files = payload.files;
|
||||
// If binary files were uploaded via multer:
|
||||
if (Array.isArray(req.files) && req.files.length > 0) {
|
||||
@@ -96,7 +96,7 @@ function parseDeliveryPayload(req) {
|
||||
};
|
||||
});
|
||||
}
|
||||
return { payload, externalNumber, date, supplierId, lines, files };
|
||||
return { payload, externalNumber, date, createdAt, supplierId, lines, files };
|
||||
}
|
||||
|
||||
function requireSelectedCompany(req) {
|
||||
@@ -354,11 +354,12 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
|
||||
try {
|
||||
const { externalNumber, date, supplierId, lines, files } = parseDeliveryPayload(req);
|
||||
const { externalNumber, date, createdAt, supplierId, lines, files } = parseDeliveryPayload(req);
|
||||
logDeliveryFiles(files, 'create');
|
||||
const delivery = await db.create(req.user.id, {
|
||||
externalNumber,
|
||||
date,
|
||||
createdAt,
|
||||
supplierId,
|
||||
lines,
|
||||
files,
|
||||
@@ -628,6 +629,9 @@ export function register(app, basePath = '') {
|
||||
if (Object.prototype.hasOwnProperty.call(parsed.payload, 'date')) {
|
||||
patch.date = parsed.date;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(parsed.payload, 'createdAt')) {
|
||||
patch.createdAt = parsed.createdAt;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(parsed.payload, 'supplierId')) {
|
||||
patch.supplierId = parsed.supplierId;
|
||||
}
|
||||
|
||||
@@ -175,12 +175,13 @@ export function register(app, basePath = '') {
|
||||
return res.status(400).json({ error: selected.error });
|
||||
}
|
||||
|
||||
const { number, date, entityId, lines } = req.body ?? {};
|
||||
const { number, date, createdAt, entityId, lines } = req.body ?? {};
|
||||
|
||||
try {
|
||||
const order = await db.create(req.user.id, {
|
||||
number,
|
||||
date,
|
||||
createdAt,
|
||||
entityId,
|
||||
lines,
|
||||
});
|
||||
@@ -396,6 +397,9 @@ export function register(app, basePath = '') {
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'date')) {
|
||||
patch.date = body.date;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'createdAt')) {
|
||||
patch.createdAt = body.createdAt;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'entityId')) {
|
||||
patch.entityId = body.entityId;
|
||||
}
|
||||
|
||||
@@ -175,12 +175,13 @@ export function register(app, basePath = '') {
|
||||
return res.status(400).json({ error: selected.error });
|
||||
}
|
||||
|
||||
const { number, date, entityId, lines } = req.body ?? {};
|
||||
const { number, date, createdAt, entityId, lines } = req.body ?? {};
|
||||
|
||||
try {
|
||||
const quote = await db.create(req.user.id, {
|
||||
number,
|
||||
date,
|
||||
createdAt,
|
||||
entityId,
|
||||
lines,
|
||||
});
|
||||
@@ -396,6 +397,9 @@ export function register(app, basePath = '') {
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'date')) {
|
||||
patch.date = body.date;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'createdAt')) {
|
||||
patch.createdAt = body.createdAt;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'entityId')) {
|
||||
patch.entityId = body.entityId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user