Merge branch 'dev' of github.com:fleetside72/forecast_api into dev
This commit is contained in:
commit
d01a2f9f74
11
index.js
11
index.js
@ -1,5 +1,6 @@
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
|
var https = require('https');
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
const server = express();
|
const server = express();
|
||||||
const pg = require('pg');
|
const pg = require('pg');
|
||||||
@ -9,6 +10,15 @@ var fs = require('fs');
|
|||||||
var readline = require('readline');
|
var readline = require('readline');
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
key: fs.readFileSync('./key.pem'),
|
||||||
|
cert: fs.readFileSync('./cert.pem'),
|
||||||
|
passprase: []
|
||||||
|
};
|
||||||
|
|
||||||
|
https.createServer(options,server).listen(3000, () => console.log('started'));
|
||||||
|
//server.listen(3000, () => console.log('started'))
|
||||||
|
|
||||||
var Postgres = new pg.Client({
|
var Postgres = new pg.Client({
|
||||||
user: process.env.user,
|
user: process.env.user,
|
||||||
password: process.env.password,
|
password: process.env.password,
|
||||||
@ -353,4 +363,3 @@ function build_where(req, c, w, d, args) {
|
|||||||
return { c, w, d };
|
return { c, w, d };
|
||||||
}
|
}
|
||||||
|
|
||||||
server.listen(3000, () => console.log('started'))
|
|
||||||
|
@ -23,10 +23,10 @@ mseq AS (
|
|||||||
--select * from mseq
|
--select * from mseq
|
||||||
,base AS (
|
,base AS (
|
||||||
SELECT
|
SELECT
|
||||||
--order_season
|
order_season
|
||||||
--,order_month
|
,order_month
|
||||||
--,version
|
,version
|
||||||
--,iter
|
,iter
|
||||||
,part_descr
|
,part_descr
|
||||||
,bill_cust_descr
|
,bill_cust_descr
|
||||||
,ship_cust_descr
|
,ship_cust_descr
|
||||||
@ -37,14 +37,30 @@ FROM
|
|||||||
WHERE
|
WHERE
|
||||||
where_clause
|
where_clause
|
||||||
GROUP BY
|
GROUP BY
|
||||||
--order_season
|
order_season
|
||||||
--,order_month
|
,order_month
|
||||||
--,version
|
,version
|
||||||
--,iter
|
,iter
|
||||||
,part_descr
|
,part_descr
|
||||||
,bill_cust_descr
|
,bill_cust_descr
|
||||||
,ship_cust_descr
|
,ship_cust_descr
|
||||||
)
|
)
|
||||||
|
, basket AS (
|
||||||
|
SELECT
|
||||||
|
part_descr
|
||||||
|
,bill_cust_descr
|
||||||
|
,ship_cust_descr
|
||||||
|
,SUM(units) units
|
||||||
|
,SUM(value_usd) value_usd
|
||||||
|
FROM
|
||||||
|
base
|
||||||
|
GROUP BY
|
||||||
|
part_descr
|
||||||
|
,bill_cust_descr
|
||||||
|
,ship_cust_descr
|
||||||
|
ORDER BY
|
||||||
|
value_usd desc
|
||||||
|
)
|
||||||
,months AS (
|
,months AS (
|
||||||
SELECT
|
SELECT
|
||||||
order_season
|
order_season
|
||||||
@ -123,8 +139,8 @@ SELECT
|
|||||||
,(SELECT jsonb_agg(row_to_json(months)::jsonb) FROM months)
|
,(SELECT jsonb_agg(row_to_json(months)::jsonb) FROM months)
|
||||||
,'mpvt'
|
,'mpvt'
|
||||||
,(SELECT jsonb_agg(row_to_json(mlist)::jsonb) FROM mlist)
|
,(SELECT jsonb_agg(row_to_json(mlist)::jsonb) FROM mlist)
|
||||||
,'base'
|
,'basket'
|
||||||
,(SELECT jsonb_agg(row_to_json(base)::jsonb) FROM base)
|
,(SELECT jsonb_agg(row_to_json(basket)::jsonb) FROM basket)
|
||||||
,'totals'
|
,'totals'
|
||||||
,(SELECT jsonb_agg(row_to_json(totals)::jsonb) FROM totals)
|
,(SELECT jsonb_agg(row_to_json(totals)::jsonb) FROM totals)
|
||||||
) package
|
) package
|
Loading…
Reference in New Issue
Block a user