From f0dd2ece8f8f3d6218e0febf0c9b0c60caa10d2f Mon Sep 17 00:00:00 2001 From: subhadeepbiswas26 Date: Mon, 17 Apr 2023 15:40:03 +0100 Subject: [PATCH] feat: add order edit --- lib/orderedits.js | 15 +++++++++++++++ lib/services.js | 6 ++++++ package.json | 1 + 3 files changed, 22 insertions(+) create mode 100644 lib/orderedits.js diff --git a/lib/orderedits.js b/lib/orderedits.js new file mode 100644 index 0000000..fc65c3d --- /dev/null +++ b/lib/orderedits.js @@ -0,0 +1,15 @@ +import { orderEditsService } from './services' +import { + createStandardDelete +} from './helpers' +const nconf = require('nconf') + +export const deleteOrderEdits = createStandardDelete({ + itemName: 'order-edits', + service: orderEditsService +}) + + +if (nconf.get('clean')) { + deleteOrderEdits() +} diff --git a/lib/services.js b/lib/services.js index a2c2a90..b76a10b 100644 --- a/lib/services.js +++ b/lib/services.js @@ -87,6 +87,11 @@ const createCarts = () => createRequestBuilder({ projectKey: config.projectKey }) .carts +const createOrderEdits = () => + createRequestBuilder({ projectKey: config.projectKey }) + .orderEdits + + export const projectService = createProjectService() export const storeService = createStoreService() export const zonesService = createZonesService() @@ -105,3 +110,4 @@ export const channelsService = createChannels() export const typesService = createTypes() export const inventoryService = createInventory() export const cartsService = createCarts() +export const orderEditsService = createOrderEdits() diff --git a/package.json b/package.json index 187b68c..b60bc0a 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "clean:products": "npm run build && node dist/lib/products.js --clean", "clean:taxCategories": "npm run build && node dist/lib/tax-categories.js --clean", "clean:types": "npm run build && node dist/lib/types.js --clean", + "clean:order-edits": "npm run build && node dist/lib/orderedits.js --clean", "start": "npm run build && node dist/lib/data.js --start", "lint": "prettier --write ./lib/** && eslint --fix ./lib/**" },