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
router.get('/code_price/:billcode/:shipcode/:partcode/:qty', async (ctx) => {
const partcode = ctx.params.partcode;
const billcode = ctx.params.billcode;
const shipcode = ctx.params.shipcode;
const qty = ctx.params.qty;
const { billcode, shipcode, partcode, qty } = ctx.params;
const result = await client.queryObject({args: [billcode, shipcode, partcode, qty], text: query} );
const procd = apply_guidance(result.rows[0]["doc"])
ctx.response.body = procd;
ctx.response.body = apply_guidance(result.rows[0]["doc"]);
});
// 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) => {
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 { billcode, shipcode, stlc, dseg, qty } = ctx.params;
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 = procd;
ctx.response.body = apply_guidance(result.rows[0]["doc"]);
});
app.use(router.routes());
app.use(router.allowedMethods());