diff --git a/api.ts b/api.ts index 46e642c..3c79a8b 100644 --- a/api.ts +++ b/api.ts @@ -55,6 +55,14 @@ router.get('/dseg_price/:billcode/:shipcode/:stlc/:dseg/:qty', async (ctx) => { ctx.response.body = ag.guidance.finalPrice.Snapped; }); +// specific customres codes but generic style code and data segment to accomodate custom colors and branding +router.get('/dseg_reason/:billcode/:shipcode/:stlc/:dseg/:qty', async (ctx) => { + const { billcode, shipcode, stlc, dseg, qty } = ctx.params; + const result = await client.queryObject({args: [billcode, shipcode, stlc, dseg, qty], text: query_dseg} ); + const ag = apply_guidance(result.rows[0]["doc"]); + ctx.response.body = ag.guidance.finalPrice.Reason; +}); + app.use(router.routes()); app.use(router.allowedMethods());