release/2024-11-01 - Misc fixes
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user