IO-2520 Change Logging back to default and adjust start and end to be default

Datapump will be run daily as per Sofia

Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
Allan Carr
2024-08-22 11:35:15 -07:00
parent 4fa0593bb5
commit bb3d3fbe72

View File

@@ -56,8 +56,8 @@ exports.default = async (req, res) => {
try { try {
const { jobs, bodyshops_by_pk } = await client.request(queries.KAIZEN_QUERY, { const { jobs, bodyshops_by_pk } = await client.request(queries.KAIZEN_QUERY, {
bodyshopid: bodyshop.id, bodyshopid: bodyshop.id,
start: start ? moment(start).startOf("hours") : moment().subtract(2, "hours").startOf("hour"), start: start ? moment(start).startOf("day") : moment().subtract(5, "days").startOf("day"),
...(end && { end: moment(end).endOf("hours") }) ...(end && { end: moment(end).endOf("day") })
}); });
const kaizenObject = { const kaizenObject = {
@@ -176,24 +176,19 @@ exports.default = async (req, res) => {
} finally { } finally {
sftp.end(); sftp.end();
} }
// sendServerEmail({ sendServerEmail({
// subject: `Kaizen Report ${moment().format("MM-DD-YY")}`, subject: `Kaizen Report ${moment().format("MM-DD-YY")}`,
// text: `Errors: ${allErrors.map((e) => JSON.stringify(e, null, 2))} text: `Errors: ${allErrors.map((e) => JSON.stringify(e, null, 2))}
// Uploaded: ${JSON.stringify( Uploaded: ${JSON.stringify(
// allxmlsToUpload.map((x) => ({ filename: x.filename, count: x.count })), allxmlsToUpload.map((x) => ({ filename: x.filename, count: x.count })),
// null, null,
// 2 2
// )} )}
// `, `
// }); });
res.sendStatus(200); res.sendStatus(200);
} catch (error) { } catch (error) {
res.status(200).json(error); res.status(200).json(error);
sendServerEmail({
subject: `Kaizen Report ${moment().format("MM-DD-YY @ HH:mm:ss")}`,
text: `Errors: JSON.stringify(error)}
All Errors: ${allErrors.map((e) => JSON.stringify(e, null, 2))}`
});
} }
}; };