const consoleDir = require("../../utils/consoleDir"); const { sendTaskEmail } = require("../../email/sendemail"); // { // "changedFieldNames": [ // "description", // "updated_at" // ], // "changedFields": { // "description": "sadasdasdasdsadssdsaddddsdsd", // "updated_at": "2025-02-10T19:20:34.195086+00:00" // }, // "isNew": false, // "data": { // "assigned_to": "5e4f78a2-0f23-4e7e-920c-02a4e016b398", // "billid": null, // "bodyshopid": "71f8494c-89f0-43e0-8eb2-820b52d723bc", // "completed": false, // "completed_at": null, // "created_at": "2025-02-09T20:02:46.839271+00:00", // "created_by": "dave@imex.dev", // "deleted": false, // "deleted_at": null, // "description": "sadasdasdasdsadssdsaddddsdsd", // "due_date": null, // "id": "ca1c49a9-3c26-46cb-bebd-4b93f02cad2a", // "jobid": "ec1c26c7-b0ea-493f-9bba-30efc291e0fa", // "joblineid": "84b5bbf9-ab57-4c77-abb0-8fdd8709c9ff", // "partsorderid": null, // "priority": 2, // "remind_at": null, // "remind_at_sent": null, // "title": "sd", // "updated_at": "2025-02-10T19:20:34.195086+00:00" // }, // "trigger": { // "name": "notifications_tasks" // }, // "table": { // "name": "tasks", // "schema": "public" // }, // "jobId": "ec1c26c7-b0ea-493f-9bba-30efc291e0fa", // "watchers": [ // "dave@imex.dev" // ], // "bodyShopId": "71f8494c-89f0-43e0-8eb2-820b52d723bc", // "bodyShopName": "Rome Online Collision DEMO" // } const tasksUpdatedCreatedBuilder = async (data) => { consoleDir(data); // Step 0: Check to see if the users are watching the current scenario // Step 1: Dispatch Email to all watchers // sendTaskEmail({ // bcc: data.watchers, // subject: `Task Updated: ${data.data.title}`, // text: `Task Updated: ${data.data.title}` // }); // Step 2: Send notification and basic paramaters to a real time job queue to debounce potential multiple notifications }; module.exports = tasksUpdatedCreatedBuilder;