This commit is contained in:
seb
2026-10-03 23:13:40 +02:00
parent 6520665dcf
commit 3b74c12f4e
36 changed files with 3669 additions and 2183 deletions

View File

@@ -41,7 +41,7 @@ export default function createUnderParent(provider) {
* const article = await store.article.createUnderParent({ googleAuthId: 42, parentId: 5, name: 'Cola' });
* // => { id, parentId, name, sku, track_stock }
*/
return async ({ googleAuthId, parentId, name, track_stock, trackStock }, tx) => {
return async ({ googleAuthId, parentId, name, track_stock, trackStock, sku: inputSku }, tx) => {
const rawTrack = track_stock ?? trackStock;
const finalTrackStock = rawTrack == null ? 1 : (rawTrack ? 1 : 0);
@@ -53,7 +53,7 @@ export default function createUnderParent(provider) {
);
const unitId = await ensureUnit(runner, languageId, companyId);
const sku = await allocateSku(companyId, runner);
const sku = (typeof inputSku === 'string' && inputSku.trim()) ? inputSku.trim() : await allocateSku(companyId, runner);
const slug = await resolveSlug(runner, { companyId, languageId, name });
let article;