vault backup: 2023-11-10 16:08:54

This commit is contained in:
Paul Trowbridge 2023-11-10 16:08:54 -05:00
parent 042a8abc0f
commit 784095dd7f

21
api.ts
View File

@ -35,29 +35,16 @@ const query_dseg = await Deno.readTextFile("sql/get_dseg.pg.sql");
// exact scenario for existing codes // exact scenario for existing codes
router.get('/code_price/:billcode/:shipcode/:partcode/:qty', async (ctx) => { router.get('/code_price/:billcode/:shipcode/:partcode/:qty', async (ctx) => {
const { billcode, shipcode, partcode, qty } = ctx.params;
const partcode = ctx.params.partcode;
const billcode = ctx.params.billcode;
const shipcode = ctx.params.shipcode;
const qty = ctx.params.qty;
const result = await client.queryObject({args: [billcode, shipcode, partcode, qty], text: query} ); const result = await client.queryObject({args: [billcode, shipcode, partcode, qty], text: query} );
const procd = apply_guidance(result.rows[0]["doc"]) ctx.response.body = apply_guidance(result.rows[0]["doc"]);
ctx.response.body = procd;
}); });
// specific customres codes but generic style code and data segment to accomodate custom colors and branding // specific customres codes but generic style code and data segment to accomodate custom colors and branding
router.get('/dseg_price/:billcode/:shipcode/:stlc/:dseg/:qty', async (ctx) => { router.get('/dseg_price/:billcode/:shipcode/:stlc/:dseg/:qty', async (ctx) => {
const { billcode, shipcode, stlc, dseg, qty } = ctx.params;
const stlc = ctx.params.stlc;
const dseg = ctx.params.dseg;
const billcode = ctx.params.billcode;
const shipcode = ctx.params.shipcode;
const qty = ctx.params.qty;
const result = await client.queryObject({args: [billcode, shipcode, stlc, dseg, qty], text: query_dseg} ); const result = await client.queryObject({args: [billcode, shipcode, stlc, dseg, qty], text: query_dseg} );
const procd = apply_guidance(result.rows[0]["doc"]) ctx.response.body = apply_guidance(result.rows[0]["doc"]);
ctx.response.body = procd;
}); });
app.use(router.routes()); app.use(router.routes());
app.use(router.allowedMethods()); app.use(router.allowedMethods());