u
This commit is contained in:
@@ -361,6 +361,19 @@
|
||||
* date:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* createdAt:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* ledger:
|
||||
* type: object
|
||||
* description: Ledger booking summary for this delivery
|
||||
* properties:
|
||||
* totalPositions:
|
||||
* type: integer
|
||||
* description: Total number of position lines on this manifest
|
||||
* completelyOnLedgerPositions:
|
||||
* type: integer
|
||||
* description: Number of positions whose quantity is fully transacted in the ledger
|
||||
* DeliveryLine:
|
||||
* type: object
|
||||
* required: [id, sku, name, pu, amount, net, rebate, taxrate, comment]
|
||||
@@ -591,6 +604,9 @@
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: Document date / valid-until
|
||||
* createdAt:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* Quote:
|
||||
* allOf:
|
||||
* - $ref: '#/components/schemas/QuoteSummary'
|
||||
@@ -620,6 +636,9 @@
|
||||
* type: string
|
||||
* format: date-time
|
||||
* description: Document date / expected delivery
|
||||
* createdAt:
|
||||
* type: string
|
||||
* format: date-time
|
||||
* Order:
|
||||
* allOf:
|
||||
* - $ref: '#/components/schemas/OrderSummary'
|
||||
|
||||
@@ -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