vault backup: 2023-11-03 21:16:26

This commit is contained in:
Paul Trowbridge 2023-11-03 21:16:26 -04:00
parent 4dc52b8826
commit 29e7be99f3

7
api.ts
View File

@ -31,6 +31,10 @@ await client.connect();
// Load SQL from file
const query = await Deno.readTextFile("sql/get.pg.sql");
function apply_guidance(doc: any) {
return doc;
}
// Define a route to retrieve values from the database using parameters
router.get('/code_price/:billcode/:shipcode/:partcode/:qty', async (ctx) => {
@ -42,7 +46,8 @@ router.get('/code_price/:billcode/:shipcode/:partcode/:qty', async (ctx) => {
//console.log(partcode)
//console.log(customer)
const result = await client.queryObject({args: [billcode, shipcode, partcode, qty], text: query} );
ctx.response.body = result.rows;
const procd = apply_guidance(result.rows[0]["doc"])
ctx.response.body = procd
});
app.use(router.routes());