From 5511dd44cef638a9b42a38b5b37b5d6efca87a90 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 24 Jan 2022 13:32:38 -0800 Subject: [PATCH] Autohouse - Export 1 --- server/data/autohouse.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/data/autohouse.js b/server/data/autohouse.js index 78b5be34e..5ff98cff9 100644 --- a/server/data/autohouse.js +++ b/server/data/autohouse.js @@ -37,12 +37,15 @@ exports.default = async (req, res) => { //Query for the List of Bodyshop Clients. logger.log("autohouse-start", "DEBUG", "api", null, null); const { bodyshops } = await client.request(queries.GET_AUTOHOUSE_SHOPS); - 639; + const specificShopIds = req.body.bodyshopIds; // ['uuid] + const start = req.body.start; //YYYY-MM-DD const allxmlsToUpload = []; const allErrors = []; try { - for (const bodyshop of bodyshops) { + for (const bodyshop of specificShopIds + ? bodyshops.filter((b) => specificShopIds.includes(b.id)) + : bodyshops) { logger.log("autohouse-start-shop-extract", "DEBUG", "api", bodyshop.id, { shopname: bodyshop.shopname, }); @@ -52,7 +55,9 @@ exports.default = async (req, res) => { queries.AUTOHOUSE_QUERY, { bodyshopid: bodyshop.id, - start: moment().subtract(3, "days").startOf("day"), + start: start + ? moment(start).startOf("day") + : moment().subtract(3, "days").startOf("day"), } );