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

@@ -50,7 +50,7 @@ const getClient = async () => {
async function OpenSearchUpdateHandler(req, res) {
try {
var osClient = await getClient();
var osClient = await getClient();
// const osClient = new Client({
// node: `https://imex:password@search-imexonline-search-ixp2stfvwp6qocjsowzjzyreoy.ca-central-1.es.amazonaws.com`,
// });
@@ -74,12 +74,18 @@ async function OpenSearchUpdateHandler(req, res) {
const jobsData = await gqlclient.request(`query{jobs{
id
bodyshopid:shopid
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,12 +134,12 @@ async function OpenSearchUpdateHandler(req, res) {
vehicles {
id
bodyshopid: shopid
v_model_yr
v_model_desc
v_make_desc
v_color
v_vin
plate_no
plate_no
v_model_yr
v_model_desc
v_make_desc
v_color
v_vin
}
}
`);
@@ -155,11 +161,25 @@ plate_no
payments {
id
amount
paymentnum
created_at
exportedat
memo
payer
paymentnum
transactionid
type
job {
id
ownerid
ownr_co_nm
ownr_fn
ownr_ln
owner {
id
ownr_co_nm
ownr_fn
ownr_ln
}
ro_number
bodyshopid: shopid
}
@@ -187,9 +207,11 @@ plate_no
const billsData = await gqlclient.request(`{
bills {
id
total
invoice_number
date
exported
invoice_number
is_credit_memo
total
vendor {
name
id
@@ -200,9 +222,7 @@ plate_no
bodyshopid: shopid
}
}
}
`);
}`);
for (let i = 0; i <= billsData.bills.length / batchSize; i++) {
const slicedArray = billsData.bills.slice(
i * batchSize,