This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
const debug = require('debug')('auth'); | |
const config = require('../../config'); | |
const qs = require('qs'); | |
async function awsCallTokenEndpoint(grantType, accessToken) { | |
const data = { | |
grant_type: grantType, | |
client_id: config.cognito.clientId, | |
code: accessToken, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jwt = require('jsonwebtoken'); | |
function generateAuthToken(user) { | |
const token = jwt.sign( | |
{ | |
id: user.id, | |
email: user.email, | |
firstName: user.firstName, | |
lastName: user.lastName, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const dotEnvPath = path.resolve('./.env'); | |
const dotenv = require('dotenv').config({ path: dotEnvPath }); | |
const config = {}; | |
config.secret = process.env.SECRET; | |
config.port = process.env.PORT || 3001; | |
config.cognito = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Customer | item | Price | items | |
---|---|---|---|---|
Elton John | pasta | 2.5 | 2 | |
Jimmy Page | soup | 1.99 | 1 | |
Billy Joel | beer | 3.5 | 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table sales ( | |
id integer, | |
first_name varchar, | |
last_name varchar, | |
item_name varchar, | |
item_qty integer, | |
total_spent decimal | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aact_ali01 geo EU28 | |
aact_ali01 geo EU27 | |
aact_ali01 geo EU25 | |
aact_ali01 geo EU15 | |
aact_ali01 geo EA19 | |
aact_ali01 geo EA16 | |
aact_ali01 geo EA12 | |
aact_ali01 geo EA11 | |
aact_ali01 geo BE | |
aact_ali01 geo BG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"Item": | |
{"category": | |
{ "geo":["EU28","EU27","EU15","EA11","EL","SI","SK","ES","FI","SE","BE","FR","UK","IS","HR","NO","CH","EA19","BG","IT","MK","TR","CY","CZ","LV","LT","EU25","EA16","DK","LU","HU","DE","MT","NL","EA12","EE","AT","PL","IE","PT","RO"], | |
"itm_newa":["40000","41000","42000"], | |
"time":["1999","1998","1997","1996","1995","1994","1993","1992","1991","1990","1989","1988","1987","1986","1985","1984","1983","1982","1981","1980","1979","1978","1977","1976","1975","1974","2018","1973","2017","2016","2015","2014","2013","2012","2011","2010","2009","2008","2007","2006","2005","2004","2003","2002","2001","2000"] | |
}, | |
"dataset":"aact_ali01" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create temp table t_data | |
( | |
customer varchar, | |
customer_first_name varchar, | |
customer_last_name varchar, | |
item_name varchar, | |
total_spent decimal, | |
item_qty integer | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
copy t_data(customer, item_name, total_spent, item_qty )from stdin DELIMITER ','; | |
Elton John, pasta, 2.5, 2 | |
Jimmy Page, soup, 1.99, 1 | |
Billy Joel, beer, 3.5, 6 | |
\. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update t_data set customer_first_name = split_part(customer,' ',1) ; |
OlderNewer