Merged in feature/IO-2261-opensearch-replacements (pull request #748)

Feature/IO-2261 opensearch replacements
This commit is contained in:
Allan Carr
2023-05-04 22:16:49 +00:00
committed by Patrick Fic
11 changed files with 280 additions and 135 deletions

View File

@@ -70,12 +70,18 @@ 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",
@@ -128,8 +134,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,
@@ -146,15 +154,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,
};
@@ -180,7 +207,7 @@ async function OpenSearchUpdateHandler(req, res) {
async function OpensearchSearchHandler(req, res) {
try {
const { search, bodyshopid } = req.body;
const { search, bodyshopid, index } = req.body;
if (!req.user) {
res.sendStatus(401);
return;
@@ -209,6 +236,7 @@ async function OpensearchSearchHandler(req, res) {
var osClient = await getClient();
const { body } = await osClient.search({
...(index ? { index } : {}),
body: {
size: 100,
query: {