Add additional logging to OS Handler.
This commit is contained in:
@@ -25,6 +25,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
||||
|
||||
switch (req.body.table.name) {
|
||||
case "jobs":
|
||||
logger.log("os-handler-jobs", "DEBUG", req.user.email, null, {
|
||||
jobid: req.body.event.data.new.id,
|
||||
bodyshopid: req.body.event.data.new.shopid
|
||||
});
|
||||
document = pick(req.body.event.data.new, [
|
||||
"id",
|
||||
"bodyshopid",
|
||||
@@ -49,6 +53,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
||||
document.bodyshopid = req.body.event.data.new.shopid;
|
||||
break;
|
||||
case "vehicles":
|
||||
logger.log("os-handler-vehicles", "DEBUG", req.user.email, null, {
|
||||
vehicleid: req.body.event.data.new.id,
|
||||
bodyshopid: req.body.event.data.new.shopid
|
||||
});
|
||||
document = pick(req.body.event.data.new, [
|
||||
"id",
|
||||
"v_model_yr",
|
||||
@@ -61,6 +69,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
||||
document.bodyshopid = req.body.event.data.new.shopid;
|
||||
break;
|
||||
case "owners":
|
||||
logger.log("os-handler-owners", "DEBUG", req.user.email, null, {
|
||||
ownerid: req.body.event.data.new.id,
|
||||
bodyshopid: req.body.event.data.new.shopid
|
||||
});
|
||||
document = pick(req.body.event.data.new, ["id", "ownr_fn", "ownr_ln", "ownr_co_nm", "ownr_ph1", "ownr_ph2"]);
|
||||
document.bodyshopid = req.body.event.data.new.shopid;
|
||||
break;
|
||||
@@ -96,9 +108,15 @@ async function OpenSearchUpdateHandler(req, res) {
|
||||
...bill.bills_by_pk,
|
||||
bodyshopid: bill.bills_by_pk.job.shopid
|
||||
};
|
||||
|
||||
logger.log("os-handler-bills", "DEBUG", req.user.email, null, {
|
||||
billid: req.body.event.data.new.id,
|
||||
bodyshopid: bill.bills_by_pk.job.shopid
|
||||
});
|
||||
break;
|
||||
case "payments":
|
||||
//Query to get the job and RO number
|
||||
|
||||
const payment = await client.request(
|
||||
`query ADMIN_GET_PAYMENT_BY_ID($paymentId: uuid!) {
|
||||
payments_by_pk(id: $paymentId) {
|
||||
@@ -139,6 +157,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
||||
...payment.payments_by_pk,
|
||||
bodyshopid: payment.payments_by_pk.job.shopid
|
||||
};
|
||||
logger.log("os-handler-payments", "DEBUG", req.user.email, null, {
|
||||
paymentid: req.body.event.data.new.id,
|
||||
bodyshopid: payment.payments_by_pk.job.shopid
|
||||
});
|
||||
break;
|
||||
}
|
||||
const payload = {
|
||||
@@ -166,7 +188,9 @@ async function OpenSearchSearchHandler(req, res) {
|
||||
}
|
||||
|
||||
logger.log("os-search", "DEBUG", req.user.email, null, {
|
||||
search
|
||||
search,
|
||||
index,
|
||||
bodyshopid
|
||||
});
|
||||
|
||||
const BearerToken = req.BearerToken;
|
||||
|
||||
Reference in New Issue
Block a user