feature/IO-3096-GlobalNotifications - Checkpoint

This commit is contained in:
Dave Richer
2025-02-12 11:57:50 -05:00
parent 994ea8bb20
commit 3f75041ad9
19 changed files with 275 additions and 34 deletions

View File

@@ -1,5 +1,52 @@
const handleBillsChange = (req, res) => {
return res.status(200).json({ message: "Bills change handled." });
};
const scenarioParser = require("../utils/scenarioParser");
const handleBillsChange = async (req, res) => {
const { logger } = req;
scenarioParser(req, `req.body.event.new.jobid`).catch((e) => {
logger.log("notifications-error", "error", "notifications", null, { error: e?.message });
});
return res.status(200).json({ message: "Bills Changed Notification Event Handled." });
};
//
module.exports = handleBillsChange;
//node-app | {
// node-app | created_at: '2025-02-12T16:23:45.397685',
// node-app | delivery_info: { current_retry: 0, max_retries: 0 },
// node-app | event: {
// node-app | data: {
// node-app | new: {
// node-app | created_at: '2025-02-12T16:23:45.397685+00:00',
// node-app | date: '2025-02-13',
// node-app | due_date: null,
// node-app | exported: false,
// node-app | exported_at: null,
// node-app | federal_tax_rate: 0,
// node-app | id: '873bd1cc-0196-4920-8f2f-4b1bc06f631b',
// node-app | invoice_number: 'sadasdasd',
// node-app | is_credit_memo: false,
// node-app | isinhouse: false,
// node-app | jobid: 'f66534c6-4e1e-462d-bf4f-aca9cf2f03bc',
// node-app | local_tax_rate: 0,
// node-app | state_tax_rate: 7,
// node-app | total: 1,
// node-app | updated_at: '2025-02-12T16:23:45.397685+00:00',
// node-app | vendorid: '4c2ff2c4-af2b-4a5f-970e-3e026f0bbf9f'
// node-app | },
// node-app | old: null
// node-app | },
// node-app | op: 'INSERT',
// node-app | session_variables: {
// node-app | 'x-hasura-role': 'user',
// node-app | 'x-hasura-user-id': 'cULlDduYGDgs2oTWSZ1otJIWbfo1'
// node-app | },
// node-app | trace_context: {
// node-app | sampling_state: '1',
// node-app | span_id: 'b1bfc69e31438823',
// node-app | trace_id: '92d91c363b9a891aa41e5574dbd391d3'
// node-app | }
// node-app | },
// node-app | id: '2530b665-8421-40b6-bcf1-6d7b39fa020d',
// node-app | table: { name: 'bills', schema: 'public' },
// node-app | trigger: { name: 'notifications_bills' }
// node-app | }

View File

@@ -0,0 +1,13 @@
const scenarioParser = require("../utils/scenarioParser");
const handleNotesChange = async (req, res) => {
const { logger } = req;
scenarioParser(req, `req.body.event.new.jobid`).catch((e) => {
logger.log("notifications-error", "error", "notifications", null, { error: e?.message });
});
return res.status(200).json({ message: "Notes Changed Notification Event Handled." });
};
module.exports = handleNotesChange;

View File

@@ -1,5 +1,13 @@
const handleTimeTicketsChange = (req, res) => {
return res.status(200).json({ message: "Time Tickets change handled." });
const scenarioParser = require("../utils/scenarioParser");
const handleTimeTicketsChange = async (req, res) => {
const { logger } = req;
scenarioParser(req, `req.body.event.new.jobid`).catch((e) => {
logger.log("notifications-error", "error", "notifications", null, { error: e?.message });
});
return res.status(200).json({ message: "Time Tickets Changed Notification Event Handled." });
};
module.exports = handleTimeTicketsChange;