release/2024-11-01 - Misc fixes

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-10-29 10:53:09 -07:00
parent 3f247a9227
commit 42f1d6fa13
12 changed files with 108 additions and 61 deletions

View File

@@ -6,10 +6,11 @@ const client = require("../graphql-client/graphql-client").client;
const emailer = require("../email/sendemail");
const moment = require("moment-timezone");
const converter = require("json-2-csv");
const logger = require("../utils/logger");
exports.taskHandler = async (req, res) => {
try {
const { bodyshopid, query, variables, text, to, subject, timezone } = req.body;
const { query, variables, text, to, subject, timezone } = req.body;
//Check the variables to see if they are an object.
Object.keys(variables).forEach((key) => {
@@ -32,8 +33,10 @@ exports.taskHandler = async (req, res) => {
text,
attachments: [{ filename: "query.csv", content: csv }]
})
.catch((err) => {
console.error("Errors sending CSV Email.");
.catch((error) => {
logger.log("Tasks - Error sending CSV EMAIL", "error", req?.user?.email, null, {
error
});
});
return res.status(200).send(csv);