diff --git a/docs/api/routes/supplier/delete.md b/docs/api/routes/supplier/delete.md index 2352bd8..4973698 100644 --- a/docs/api/routes/supplier/delete.md +++ b/docs/api/routes/supplier/delete.md @@ -28,6 +28,7 @@ _No content_ | 401 | Unauthorized — `{"error":"…"}` | | 403 | Not authorized — `{"error":"…"}` | | 404 | Supplier not found — `{"error":"…"}` | +| 409 | Supplier in use — `{"error":"…"}` | --- diff --git a/src/api/routes/entity.js b/src/api/routes/entity.js index 8411213..e31bde8 100644 --- a/src/api/routes/entity.js +++ b/src/api/routes/entity.js @@ -19,6 +19,8 @@ function entityErrorStatus(error) { if (error.message === 'Name required') return 400; if (error.message === 'Number required') return 400; if (error.message === 'Number already in use') return 409; + if (error.message === 'Entity in use') return 409; + if (error.message === 'Supplier in use') return 409; if (error.message === 'Invalid customergroupId') return 400; if (error.message === 'Invalid role') return 400; return 500; diff --git a/src/api/routes/supplier.js b/src/api/routes/supplier.js index ba6bb8f..6203e46 100644 --- a/src/api/routes/supplier.js +++ b/src/api/routes/supplier.js @@ -17,6 +17,7 @@ function supplierErrorStatus(error) { if (error.message === 'Supplier not found') return 404; if (error.message === 'Supplier required') return 400; if (error.message === 'Name required') return 400; + if (error.message === 'Supplier in use') return 409; return 500; } @@ -307,6 +308,12 @@ export function register(app, basePath = '') { * application/json: * schema: * $ref: '#/components/schemas/Error' + * 409: + * description: Supplier in use + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/Error' */ // #region PATCH /supplier/:id