IO-2261 Opensearch for Payments, Bills and All Jobs

This commit is contained in:
Allan Carr
2023-05-03 16:29:01 -07:00
parent 852fd9c388
commit 759a8ac58c
10 changed files with 198 additions and 86 deletions

View File

@@ -66,18 +66,21 @@ async function OpenSearchUpdateHandler(req, res) {
document = _.pick(req.body.event.data.new, [
"id",
"bodyshopid",
"ro_number",
"clm_no",
"clm_total",
"comment",
"ins_co_nm",
"ownr_co_nm",
"ownr_fn",
"ownr_ln",
"ownr_ph1",
"ownr_ph2",
"plate_no",
"ro_number",
"status",
"ownr_co_nm",
"v_model_yr",
"v_make_desc",
"v_model_desc",
"clm_total",
"plate_no",
"ownr_ph1",
]);
document.bodyshopid = req.body.event.data.new.shopid;
break;
@@ -127,8 +130,10 @@ async function OpenSearchUpdateHandler(req, res) {
document = {
..._.pick(req.body.event.data.new, [
"id",
"invoice_number",
"date",
"exported",
"invoice_number",
"is_credit_memo",
]),
...bill.bills_by_pk,
bodyshopid: bill.bills_by_pk.job.shopid,
@@ -145,15 +150,34 @@ async function OpenSearchUpdateHandler(req, res) {
id
ro_number
shopid
ownerid
ownr_co_nm
ownr_fn
ownr_ln
owner {
id
ownr_co_nm
ownr_fn
ownr_ln
}
}
}
}
`,
}
`,
{ paymentId: req.body.event.data.new.id }
);
document = {
..._.pick(req.body.event.data.new, ["id", "invoice_number"]),
..._.pick(req.body.event.data.new, [
"id",
"amount",
"created_at",
"exportedat",
"memo",
"payer",
"paymentnum",
"transactionid",
"type",
]),
...payment.payments_by_pk,
bodyshopid: bill.payments_by_pk.job.shopid,
};