Adjust handler logging.
This commit is contained in:
@@ -25,10 +25,6 @@ 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",
|
||||
@@ -53,10 +49,6 @@ 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",
|
||||
@@ -69,10 +61,6 @@ 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;
|
||||
@@ -108,11 +96,6 @@ 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
|
||||
@@ -157,10 +140,6 @@ 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 = {
|
||||
@@ -169,6 +148,13 @@ async function OpenSearchUpdateHandler(req, res) {
|
||||
body: document
|
||||
};
|
||||
|
||||
logger.log("os-handler", "DEBUG", req.user.email, null, {
|
||||
id: req.body.event.data.new.id,
|
||||
index: req.body.table.name,
|
||||
bodyshopid: payload.body.bodyshopid
|
||||
// body: document
|
||||
});
|
||||
|
||||
const response = await osClient.index(payload);
|
||||
//console.log(response.body);
|
||||
res.status(200).json(response.body);
|
||||
|
||||
Reference in New Issue
Block a user