This commit is contained in:
seb
2026-10-16 12:35:04 +02:00
parent 144bf0ca43
commit a560a78f4d
10 changed files with 8 additions and 704 deletions

View File

@@ -52,7 +52,7 @@ export function register(app, basePath = '') {
* description: SEO text
* track_stock:
* type: boolean
* description: Whether to track inventory stock (defaults to true)
* description: Whether to track inventory stock (defaults to false)
* example:
* categoryId: 10
* name: New article
@@ -118,7 +118,7 @@ export function register(app, basePath = '') {
if (rawTrack !== undefined && typeof rawTrack !== 'boolean' && rawTrack !== 0 && rawTrack !== 1) {
return res.status(400).json({ error: 'Invalid track_stock' });
}
const track_stock = rawTrack !== undefined ? Boolean(rawTrack) : true;
const track_stock = rawTrack !== undefined ? Boolean(rawTrack) : false;
const customSku = typeof req.body?.sku === 'string' && req.body.sku.trim() ? req.body.sku.trim() : undefined;
try {

View File

@@ -69,6 +69,7 @@ export function articleErrorStatus(error) {
if (error.message === 'Invalid attributeValueId') return 400;
if (error.message === 'Invalid weight') return 400;
if (error.message === 'Invalid track_stock') return 400;
if (error.message === 'At least one warehouse is required to enable stock tracking') return 400;
if (error.message === 'Invalid categoryIds' || error.message === 'Article must have at least one category') return 400;
if (error.message === 'Attribute name not found') return 404;
if (error.message === 'attributeNameId is required to become a parent article') return 400;