Autohouse - Export 1

This commit is contained in:
Patrick Fic
2022-01-24 13:32:38 -08:00
parent d6a84b8b7f
commit 5511dd44ce

View File

@@ -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"),
}
);