From 0f6bf78f67e07ca221bd310f21496e155f0e2fa1 Mon Sep 17 00:00:00 2001 From: Gerald Baulig Date: Wed, 17 Jan 2024 16:28:24 +0100 Subject: [PATCH] feat(josb): add shop import --- datasets/demo-shop/data/seed-data/shops.yaml | 4 ++-- datasets/demo-shop/data/seed-data/users.yaml | 1 - datasets/demo-shop/jobs/job_master.json | 7 +++++++ import.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/datasets/demo-shop/data/seed-data/shops.yaml b/datasets/demo-shop/data/seed-data/shops.yaml index 31f76d5..46fb748 100644 --- a/datasets/demo-shop/data/seed-data/shops.yaml +++ b/datasets/demo-shop/data/seed-data/shops.yaml @@ -1,10 +1,10 @@ --- id: restorecommecre-demo-shop-000 - shop_number: "00000000" + shopNumber: "00000000" name: "Restorecommerce Demo Shop 000" description: "" domain: store.restorecommerce.io - organization_id: restorecommecre-demo-shop-000-organization + organizationId: restorecommecre-demo-shop-000-organization meta: modifiedBy: "" owners: diff --git a/datasets/demo-shop/data/seed-data/users.yaml b/datasets/demo-shop/data/seed-data/users.yaml index 3e83c8f..404e44e 100644 --- a/datasets/demo-shop/data/seed-data/users.yaml +++ b/datasets/demo-shop/data/seed-data/users.yaml @@ -33,7 +33,6 @@ active: true activationCode: "" passwordHash: "" - unauthenticated: false guest: false image: id: "" diff --git a/datasets/demo-shop/jobs/job_master.json b/datasets/demo-shop/jobs/job_master.json index 9dc66fc..62ba14f 100644 --- a/datasets/demo-shop/jobs/job_master.json +++ b/datasets/demo-shop/jobs/job_master.json @@ -24,6 +24,13 @@ "src": "./datasets/demo-shop/data/seed-data/", "filter": "organizations.yaml", "mutation": "mutation mutateOrganizations($var: [IIoRestorecommerceOrganizationOrganization!]!){ master_data { organization { Mutate( input: { items: $var, totalCount: 0, mode: UPSERT } ) { details{items {status {id, code, message}}, operationStatus { code message } } } } }}" + }, + { + "name": "shops", + "operation": "sync", + "src": "./datasets/demo-shop/data/seed-data/", + "filter": "shops.yaml", + "mutation": "mutation{ master_data { shop { Mutate( input: { items: ${resource_list}, totalCount: 0, mode: UPSERT } ) { details{items {status {id, code, message}}, operationStatus { code message } } } } }}" } ] } diff --git a/import.js b/import.js index 6346e7a..3d2042d 100644 --- a/import.js +++ b/import.js @@ -60,7 +60,7 @@ async function commandDataImport(cmd) { console.log('Resources imported successfully'); }); jobResult.on('error', (err) => { - console.error('Error :', err); + console.error('Error :', err, JSON.stringify(err ?? '', null, 2)); }); } }