Merge branch 'develop' into feature/view_edit_refactor
This commit is contained in:
commit
a022d90e59
69
app/package-lock.json
generated
69
app/package-lock.json
generated
@ -2875,9 +2875,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"buffer-writer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-1.0.1.tgz",
|
||||
"integrity": "sha1-Iqk2kB4wKa/NdUfrRIfOtpejvwg="
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
|
||||
"integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw=="
|
||||
},
|
||||
"buffer-xor": {
|
||||
"version": "1.0.3",
|
||||
@ -3439,9 +3439,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"connect-pg-simple": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/connect-pg-simple/-/connect-pg-simple-5.0.0.tgz",
|
||||
"integrity": "sha512-WZ7xkN+qe5bbDLgZ1L9GxnSbr155cJHmfNRzVR5hBvqio7Pg/vuH7Cf8lPUSFClQjtybYSejUqyO54sYt4cg+w==",
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/connect-pg-simple/-/connect-pg-simple-6.0.1.tgz",
|
||||
"integrity": "sha512-zW5AOtRNOLcXxphSmQ+oYj0snlLs1Je3u5K2NWyF7WhMVoPvnQXraK2wzS8f7qLwhMcmYukah2ymu0Gdxf7Qsg==",
|
||||
"requires": {
|
||||
"pg": "^7.4.3"
|
||||
}
|
||||
@ -9484,7 +9484,7 @@
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
},
|
||||
"minipass": {
|
||||
@ -10236,9 +10236,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"packet-reader": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-0.3.1.tgz",
|
||||
"integrity": "sha1-zWLmCvjX/qinBexP+ZCHHEaHHyc="
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz",
|
||||
"integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ=="
|
||||
},
|
||||
"pako": {
|
||||
"version": "1.0.10",
|
||||
@ -10410,15 +10410,15 @@
|
||||
"dev": true
|
||||
},
|
||||
"pg": {
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-7.4.3.tgz",
|
||||
"integrity": "sha1-97b5P1NA7MJZavu5ShPj1rYJg0s=",
|
||||
"version": "7.12.1",
|
||||
"resolved": "https://registry.npmjs.org/pg/-/pg-7.12.1.tgz",
|
||||
"integrity": "sha512-l1UuyfEvoswYfcUe6k+JaxiN+5vkOgYcVSbSuw3FvdLqDbaoa2RJo1zfJKfPsSYPFVERd4GHvX3s2PjG1asSDA==",
|
||||
"requires": {
|
||||
"buffer-writer": "1.0.1",
|
||||
"packet-reader": "0.3.1",
|
||||
"buffer-writer": "2.0.0",
|
||||
"packet-reader": "1.0.0",
|
||||
"pg-connection-string": "0.1.3",
|
||||
"pg-pool": "~2.0.3",
|
||||
"pg-types": "~1.12.1",
|
||||
"pg-pool": "^2.0.4",
|
||||
"pg-types": "^2.1.0",
|
||||
"pgpass": "1.x",
|
||||
"semver": "4.3.2"
|
||||
},
|
||||
@ -10446,9 +10446,9 @@
|
||||
"integrity": "sha512-8aZ9xdx7Pe/ppFYVOqvU5KgmM6ttXjaBlsl9Y8yzrUH4xSNVucJKKOwm4Y4H+LCvzZGjZIm4Rkf2Ajt5ixtkBQ=="
|
||||
},
|
||||
"pg-pool": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.3.tgz",
|
||||
"integrity": "sha1-wCIDLIlJ8xKk+R+2QJzgQHa+Mlc="
|
||||
"version": "2.0.7",
|
||||
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.7.tgz",
|
||||
"integrity": "sha512-UiJyO5B9zZpu32GSlP0tXy8J2NsJ9EFGFfz5v6PSbdz/1hBLX1rNiiy5+mAm5iJJYwfCv4A0EBcQLGWwjbpzZw=="
|
||||
},
|
||||
"pg-promise": {
|
||||
"version": "8.7.5",
|
||||
@ -10521,13 +10521,14 @@
|
||||
}
|
||||
},
|
||||
"pg-types": {
|
||||
"version": "1.12.1",
|
||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-1.12.1.tgz",
|
||||
"integrity": "sha1-1kCH45A7WP+q0nnnWVxSIIoUw9I=",
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
||||
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
||||
"requires": {
|
||||
"postgres-array": "~1.0.0",
|
||||
"pg-int8": "1.0.1",
|
||||
"postgres-array": "~2.0.0",
|
||||
"postgres-bytea": "~1.0.0",
|
||||
"postgres-date": "~1.0.0",
|
||||
"postgres-date": "~1.0.4",
|
||||
"postgres-interval": "^1.1.0"
|
||||
}
|
||||
},
|
||||
@ -13144,9 +13145,9 @@
|
||||
}
|
||||
},
|
||||
"postgres-array": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-1.0.2.tgz",
|
||||
"integrity": "sha1-jgsy6wO/d6XAp4UeBEHBaaJWojg="
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="
|
||||
},
|
||||
"postgres-bytea": {
|
||||
"version": "1.0.0",
|
||||
@ -13154,9 +13155,9 @@
|
||||
"integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU="
|
||||
},
|
||||
"postgres-date": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.3.tgz",
|
||||
"integrity": "sha1-4tiXAu/bJY/52c7g/pG9BpdSV6g="
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.4.tgz",
|
||||
"integrity": "sha512-bESRvKVuTrjoBluEcpv2346+6kgB7UlnqWZsnbnCccTNq/pqfj1j6oBaN5+b/NrDXepYUT/HKadqv3iS9lJuVA=="
|
||||
},
|
||||
"postgres-interval": {
|
||||
"version": "1.1.2",
|
||||
@ -13612,7 +13613,7 @@
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
}
|
||||
}
|
||||
@ -17021,7 +17022,7 @@
|
||||
"dependencies": {
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
|
||||
"dev": true
|
||||
}
|
||||
@ -17862,7 +17863,7 @@
|
||||
},
|
||||
"wrap-ansi": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
|
@ -18,7 +18,7 @@
|
||||
"@mapbox/sphericalmercator": "^1.1.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"bootstrap": "^4.3.1",
|
||||
"connect-pg-simple": "^5.0.0",
|
||||
"connect-pg-simple": "^6.0.1",
|
||||
"express": "^4.17.1",
|
||||
"express-session": "^1.16.2",
|
||||
"leaflet": "^1.5.1",
|
||||
|
@ -72,8 +72,7 @@ async function resetPassword(req: express.Request, res: express.Response) {
|
||||
if(req.body.email != undefined) {
|
||||
// first stage: send reset token to email address
|
||||
|
||||
// this relies on the API being on the same hostname as the frontend
|
||||
const { origin } = new URL(req.protocol + '://' + req.headers.host);
|
||||
const origin = getWebAppOrigin();
|
||||
await passwordResetService.sendPasswordResetToken(req.body.email, origin);
|
||||
|
||||
return res.status(202).send({ success: true });
|
||||
@ -96,6 +95,14 @@ async function resetPassword(req: express.Request, res: express.Response) {
|
||||
}
|
||||
}
|
||||
|
||||
function getWebAppOrigin() : string {
|
||||
const origin = process.env.WEBAPP_ORIGIN;
|
||||
if (origin == undefined) {
|
||||
throw new Error('WEBAPP_ORIGIN not defined');
|
||||
}
|
||||
return origin;
|
||||
}
|
||||
|
||||
export default {
|
||||
createUser,
|
||||
getCurrentUser,
|
||||
|
@ -25,6 +25,7 @@ module.exports = {
|
||||
MAIL_SERVER_PORT: 587,
|
||||
MAIL_SERVER_USER: "mail_username",
|
||||
MAIL_SERVER_PASSWORD: "longrandompassword",
|
||||
WEBAPP_ORIGIN: "http://localhost:3000",
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -22,6 +22,7 @@ module.exports = {
|
||||
MAIL_SERVER_PORT: 587,
|
||||
MAIL_SERVER_USER: "mail_username",
|
||||
MAIL_SERVER_PASSWORD: "longrandompassword",
|
||||
WEBAPP_ORIGIN: "https://beta.colouring.london",
|
||||
}
|
||||
}
|
||||
]
|
||||
|
28
migrations/011.sustainability.down.sql
Normal file
28
migrations/011.sustainability.down.sql
Normal file
@ -0,0 +1,28 @@
|
||||
-- Remove sustainability fields, update in paralell with adding new fields
|
||||
-- BREEAM rating
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_breeam_rating;
|
||||
-- BREEAM date
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_breeam_date;
|
||||
|
||||
-- DEC (display energy certifcate, only applies to non domestic buildings)
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_dec;
|
||||
-- DEC date
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_dec_date;
|
||||
|
||||
--DEC certifcate lmk key, this would be lmkkey, no online lookup but can scrape through API. Numeric (25)
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_dec_lmkey;
|
||||
|
||||
-- Aggregate EPC rating (Estimated) for a building, derived from inidividual certificates
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_aggregate_estimate_epc;
|
||||
|
||||
-- Last significant retrofit date YYYY
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_retrofit_date;
|
||||
|
||||
--How much embodied carbon? One for ML, tons CO2 int
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_embodied_carbon;
|
||||
|
||||
--Life expectancy of the building, via further analysis
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_life_expectancy;
|
||||
|
||||
--Average lifespan of typology based on statistical analysis of similar stock
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS sust_lifespan_average;
|
67
migrations/011.sustainability.up.sql
Normal file
67
migrations/011.sustainability.up.sql
Normal file
@ -0,0 +1,67 @@
|
||||
-- BREEAM ratings, one of:
|
||||
-- - Outstanding
|
||||
-- - Excellent
|
||||
-- - Very good
|
||||
-- - Good
|
||||
-- - Pass
|
||||
-- - Unclassified
|
||||
CREATE TYPE sust_breeam_rating
|
||||
AS ENUM ('Outstanding',
|
||||
'Excellent',
|
||||
'Very good',
|
||||
'Good',
|
||||
'Pass',
|
||||
'Unclassified');
|
||||
|
||||
ALTER TABLE buildings
|
||||
ADD COLUMN IF NOT EXISTS sust_breeam_rating sust_breeam_rating DEFAULT 'Unclassified';
|
||||
|
||||
-- Date of BREEAM
|
||||
ALTER TABLE buildings
|
||||
ADD COLUMN IF NOT EXISTS sust_breeam_date smallint;
|
||||
|
||||
-- DEC (display energy certifcate, only applies to non domestic buildings)
|
||||
-- A - G
|
||||
CREATE TYPE sust_dec
|
||||
AS ENUM ('A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'G');
|
||||
|
||||
-- Date of DEC YYYY
|
||||
ALTER TABLE buildings
|
||||
ADD COLUMN IF NOT EXISTS sust_dec_date smallint;
|
||||
|
||||
|
||||
ALTER TABLE buildings
|
||||
ADD COLUMN IF NOT EXISTS sust_dec sust_dec;
|
||||
|
||||
-- Aggregate EPC rating (Estimated) for a building, derived from inidividual certificates
|
||||
-- A+ - G
|
||||
CREATE TYPE sust_aggregate_estimate_epc
|
||||
AS ENUM ('A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'G');
|
||||
|
||||
ALTER TABLE buildings
|
||||
ADD COLUMN IF NOT EXISTS sust_aggregate_estimate_epc sust_aggregate_estimate_epc;
|
||||
|
||||
-- Last significant retrofit date YYYY
|
||||
ALTER TABLE buildings
|
||||
ADD COLUMN IF NOT EXISTS sust_retrofit_date smallint;
|
||||
|
||||
--How much embodied carbon? One for ML, tons CO2 int
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS sust_embodied_carbon numeric(7,2);
|
||||
|
||||
--Life expectancy of the building, via further analysis
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS sust_life_expectancy smallint;
|
||||
|
||||
--Average lifespan of typology based on statistical analysis of similar stock
|
||||
ALTER TABLE buildings ADD COLUMN IF NOTE EXISTS sust_lifespan_average smallint;
|
Loading…
Reference in New Issue
Block a user