file meta
This commit is contained in:
@@ -107,6 +107,13 @@ export function register(app, basePath = '') {
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: '#/components/schemas/DeliveryLineInput'
|
||||
* files:
|
||||
* type: array
|
||||
* description: |
|
||||
* Attached documents (pdf or txt) stored with the delivery
|
||||
* and returned in `files` on every delivery response.
|
||||
* items:
|
||||
* $ref: '#/components/schemas/DeliveryFileInput'
|
||||
* example:
|
||||
* externalNumber: DHL-123
|
||||
* date: '2026-08-10'
|
||||
@@ -118,6 +125,10 @@ export function register(app, basePath = '') {
|
||||
* amount: 10
|
||||
* net: 99.5
|
||||
* taxrate: 19
|
||||
* files:
|
||||
* - mimetype: application/pdf
|
||||
* name: delivery-note.pdf
|
||||
* content: '<base64 encoded content>'
|
||||
* responses:
|
||||
* 201:
|
||||
* description: Created delivery
|
||||
@@ -129,7 +140,7 @@ export function register(app, basePath = '') {
|
||||
* delivery:
|
||||
* $ref: '#/components/schemas/Delivery'
|
||||
* 400:
|
||||
* description: Invalid delivery, invalid lines, or no company selected
|
||||
* description: Invalid delivery, invalid lines or files, or no company selected
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
@@ -147,7 +158,7 @@ export function register(app, basePath = '') {
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Error'
|
||||
* 404:
|
||||
* description: Company, supplier, or article not found
|
||||
* description: Company or supplier not found
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
@@ -175,7 +186,7 @@ export function register(app, basePath = '') {
|
||||
return res.status(400).json({ error: selected.error });
|
||||
}
|
||||
|
||||
const { externalNumber, date, supplierId, lines } = req.body ?? {};
|
||||
const { externalNumber, date, supplierId, lines, files } = req.body ?? {};
|
||||
|
||||
try {
|
||||
const delivery = await db.create(req.user.id, {
|
||||
@@ -183,6 +194,7 @@ export function register(app, basePath = '') {
|
||||
date,
|
||||
supplierId,
|
||||
lines,
|
||||
files,
|
||||
});
|
||||
res.status(201).json({ delivery });
|
||||
} catch (error) {
|
||||
@@ -280,6 +292,13 @@ export function register(app, basePath = '') {
|
||||
* type: array
|
||||
* items:
|
||||
* $ref: '#/components/schemas/DeliveryLineInput'
|
||||
* files:
|
||||
* type: array
|
||||
* description: |
|
||||
* Appends attachments (pdf or txt) to the delivery.
|
||||
* Omit to leave existing files unchanged.
|
||||
* items:
|
||||
* $ref: '#/components/schemas/DeliveryFileInput'
|
||||
* example:
|
||||
* externalNumber: DHL-124
|
||||
* lines: []
|
||||
@@ -312,7 +331,7 @@ export function register(app, basePath = '') {
|
||||
* schema:
|
||||
* $ref: '#/components/schemas/Error'
|
||||
* 404:
|
||||
* description: Delivery, supplier, article, or company not found
|
||||
* description: Delivery, supplier, or company not found
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
@@ -405,6 +424,9 @@ export function register(app, basePath = '') {
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'lines')) {
|
||||
patch.lines = body.lines;
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(body, 'files')) {
|
||||
patch.files = body.files;
|
||||
}
|
||||
|
||||
try {
|
||||
const delivery = await db.update(req.user.id, id, patch);
|
||||
|
||||
Reference in New Issue
Block a user