Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GQL rework Property type #198

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
399 changes: 227 additions & 172 deletions database/fixtures-data/postcodes.csv

Large diffs are not rendered by default.

3,299 changes: 1,802 additions & 1,497 deletions database/fixtures-data/properties.csv

Large diffs are not rendered by default.

619 changes: 76 additions & 543 deletions database/fixtures-data/timelines.csv

Large diffs are not rendered by default.

3,471 changes: 1,912 additions & 1,559 deletions database/fixtures-data/transactions.csv

Large diffs are not rendered by default.

35 changes: 21 additions & 14 deletions database/fixtures/20210202500001 - E20.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const tables = [
SELECT
postcode,
lat,
lng
lng,
lsoa
FROM
postcodes
WHERE
Expand All @@ -30,19 +31,21 @@ const tables = [
SELECT
CONCAT(
postcode,
'-',
IF(street IS NULL OR street = '', '', street),
IF(paon IS NULL OR paon = '', '', CONCAT(' ', SHA1(paon))),
IF(saon IS NULL OR saon = '', '', CONCAT('-', SHA1(saon)))
', ',
SHA1(
CONCAT(
IF(street IS NULL OR street = '', '', street),
IF(paon IS NULL OR paon = '', '', paon),
IF(saon IS NULL OR saon = '', '', saon)
)
)
) AS guid,
postcode,
SHA1(paon) AS paon,
SHA1(saon) AS saon,
street
postcode
FROM
properties AS a
properties
WHERE
postcode LIKE "E20%"
LIMIT 100000
*/
'properties',
/**
Expand All @@ -61,10 +64,14 @@ const tables = [
SELECT
CONCAT(
postcode,
'-',
IF(street IS NULL OR street = '', '', street),
IF(paon IS NULL OR paon = '', '', CONCAT(' ', SHA1(paon))),
IF(saon IS NULL OR saon = '', '', CONCAT('-', SHA1(saon)))
', ',
SHA1(
CONCAT(
IF(street IS NULL OR street = '', '', street),
IF(paon IS NULL OR paon = '', '', paon),
IF(saon IS NULL OR saon = '', '', saon)
)
)
) AS guid,
price,
date
Expand Down
19 changes: 19 additions & 0 deletions database/migrations/20240201100000 - properties:address.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface.removeColumn('properties', 'street'),
queryInterface.removeColumn('properties', 'paon'),
queryInterface.removeColumn('properties', 'saon'),
]);
},

down: (queryInterface, Sequelize) => {
Promise.all([
queryInterface.addColumn('properties', 'street', Sequelize.STRING),
queryInterface.addColumn('properties', 'paon', Sequelize.STRING),
queryInterface.addColumn('properties', 'saon', Sequelize.STRING),
]);
}
};
18 changes: 9 additions & 9 deletions src/graphql/__snapshots__/postcode.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
exports[`GraphQL: Postcode postcodeSearch [presets: perPage 3] by exact postcode 1`] = `
[
{
"lat": 51.547915089,
"lng": -0.00743124,
"lat": 51.547896,
"lng": -0.007389,
"postcode": "E20 1AA",
},
]
Expand All @@ -13,8 +13,8 @@ exports[`GraphQL: Postcode postcodeSearch [presets: perPage 3] by exact postcode
exports[`GraphQL: Postcode postcodeSearch [presets: perPage 3] by wildcard 1`] = `
[
{
"lat": 51.547915089,
"lng": -0.00743124,
"lat": 51.547896,
"lng": -0.007389,
"postcode": "E20 1AA",
},
{
Expand All @@ -23,7 +23,7 @@ exports[`GraphQL: Postcode postcodeSearch [presets: perPage 3] by wildcard 1`] =
"postcode": "E20 1AB",
},
{
"lat": 51.54796467,
"lat": 51.547981,
"lng": -0.007587,
"postcode": "E20 1AD",
},
Expand All @@ -38,13 +38,13 @@ exports[`GraphQL: Postcode postcodeSearch [presets: perPage 3] by wildcard: 2nd
"postcode": "E20 1AE",
},
{
"lat": 51.547427816,
"lng": -0.006803491,
"lat": 51.547473,
"lng": -0.006801,
"postcode": "E20 1AF",
},
{
"lat": 51.546690968,
"lng": -0.006835695,
"lat": 51.546673,
"lng": -0.006836,
"postcode": "E20 1AG",
},
]
Expand Down
120 changes: 47 additions & 73 deletions src/graphql/__snapshots__/property.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,32 @@
exports[`GraphQL: Property propertySearch [presets: perPage 3] by postcode wildcard 1`] = `
[
{
"paon": "cc551cd9b04a9cc3da0fd21025e8db42828d5299",
"address": "dd3c8e0d34ac3fd9dadc294e96ccd1cfa00e599a",
"postcode": {
"postcode": "E20 1AB",
},
"saon": "cd435dfdc23e7d95665b678f176329c14ac2af4a",
"street": "PRIZE WALK",
"transactions": [
{
"date": "2019-04-25",
},
],
},
{
"paon": "cc551cd9b04a9cc3da0fd21025e8db42828d5299",
"address": "dea9c5dd93a7c61fa0bcebb9ea9f2814846203d1",
"postcode": {
"postcode": "E20 1AB",
},
"saon": "1b762366cdf7cc97e2764e932f60c0edc61b5e86",
"street": "PRIZE WALK",
"transactions": [
{
"date": "2019-04-26",
},
],
},
{
"paon": "cc551cd9b04a9cc3da0fd21025e8db42828d5299",
"address": "45c7a465a6da7fc33b9d4577cacafa53e849dda6",
"postcode": {
"postcode": "E20 1AB",
},
"saon": "fe78fa628e2a410375cb37144fbdff5a766fcee3",
"street": "PRIZE WALK",
"transactions": [
{
"date": "2019-03-25",
Expand All @@ -47,41 +41,35 @@ exports[`GraphQL: Property propertySearch [presets: perPage 3] by postcode wildc
exports[`GraphQL: Property propertySearch [presets: perPage 3] by postcode wildcard: 2nd page 1`] = `
[
{
"paon": "50cd339e52b0e796c362d9937e272fd83223ba57",
"address": "8b7de6d263024ec9713f5279e13aadee8d07f7c8",
"postcode": {
"postcode": "E20 1AE",
"postcode": "E20 1AB",
},
"saon": "NULL",
"street": "DE COUBERTIN STREET",
"transactions": [
{
"date": "2017-11-10",
"date": "2022-09-16",
},
],
},
{
"paon": "1038a2b94796fb209031e42e5c58fb2ba3056c40",
"address": "77ef51b9253e7978202b37dc46113366bcddaa14",
"postcode": {
"postcode": "E20 1AQ",
"postcode": "E20 1AB",
},
"saon": "82638c43311980a3235cf87d59e533ecacff0567",
"street": "LIBERTY BRIDGE ROAD",
"transactions": [
{
"date": "2017-11-28",
"date": "2022-06-06",
},
],
},
{
"paon": "1038a2b94796fb209031e42e5c58fb2ba3056c40",
"address": "abceb3e60dc1a7d71b9756bf1ddb58de20cd5002",
"postcode": {
"postcode": "E20 1AQ",
"postcode": "E20 1AE",
},
"saon": "6f8392f9a202ccef161b4b8b2fd6148581b7739d",
"street": "LIBERTY BRIDGE ROAD",
"transactions": [
{
"date": "2018-05-09",
"date": "2017-11-10",
},
],
},
Expand All @@ -91,47 +79,41 @@ exports[`GraphQL: Property propertySearch [presets: perPage 3] by postcode wildc
exports[`GraphQL: Property propertySearchInRange [presets: perPage 2] by coordinates, in kilometers 1`] = `
[
{
"paon": "56a4db1cf753ad6f5238d6aaa2ec7f60f4463768",
"address": "dd3c8e0d34ac3fd9dadc294e96ccd1cfa00e599a",
"postcode": {
"lat": 51.540931,
"lng": -0.007492,
"postcode": "E20 1HR",
"lat": 51.548136,
"lng": -0.007724,
"postcode": "E20 1AB",
},
"saon": "a165fbd61c277745f187eaac7182d9c05d0d1171",
"street": "GLASSHOUSE GARDENS",
"transactions": [
{
"date": "2016-12-09",
"date": "2019-04-25",
},
],
},
{
"paon": "56a4db1cf753ad6f5238d6aaa2ec7f60f4463768",
"address": "dea9c5dd93a7c61fa0bcebb9ea9f2814846203d1",
"postcode": {
"lat": 51.540931,
"lng": -0.007492,
"postcode": "E20 1HR",
"lat": 51.548136,
"lng": -0.007724,
"postcode": "E20 1AB",
},
"saon": "7f03f3f2febc46f3fa832d98251b0c98f64bc19b",
"street": "GLASSHOUSE GARDENS",
"transactions": [
{
"date": "2016-12-06",
"date": "2019-04-26",
},
],
},
{
"paon": "56a4db1cf753ad6f5238d6aaa2ec7f60f4463768",
"address": "45c7a465a6da7fc33b9d4577cacafa53e849dda6",
"postcode": {
"lat": 51.540931,
"lng": -0.007492,
"postcode": "E20 1HR",
"lat": 51.548136,
"lng": -0.007724,
"postcode": "E20 1AB",
},
"saon": "a29e971b5176a9fadde4eb86c851c7d66de8004b",
"street": "GLASSHOUSE GARDENS",
"transactions": [
{
"date": "2016-12-02",
"date": "2019-03-25",
},
],
},
Expand All @@ -141,32 +123,28 @@ exports[`GraphQL: Property propertySearchInRange [presets: perPage 2] by coordin
exports[`GraphQL: Property propertySearchInRange [presets: perPage 2] by coordinates, in miles 1`] = `
[
{
"paon": "56a4db1cf753ad6f5238d6aaa2ec7f60f4463768",
"address": "dd3c8e0d34ac3fd9dadc294e96ccd1cfa00e599a",
"postcode": {
"lat": 51.540931,
"lng": -0.007492,
"postcode": "E20 1HR",
"lat": 51.548136,
"lng": -0.007724,
"postcode": "E20 1AB",
},
"saon": "a165fbd61c277745f187eaac7182d9c05d0d1171",
"street": "GLASSHOUSE GARDENS",
"transactions": [
{
"date": "2016-12-09",
"date": "2019-04-25",
},
],
},
{
"paon": "56a4db1cf753ad6f5238d6aaa2ec7f60f4463768",
"address": "dea9c5dd93a7c61fa0bcebb9ea9f2814846203d1",
"postcode": {
"lat": 51.540931,
"lng": -0.007492,
"postcode": "E20 1HR",
"lat": 51.548136,
"lng": -0.007724,
"postcode": "E20 1AB",
},
"saon": "7f03f3f2febc46f3fa832d98251b0c98f64bc19b",
"street": "GLASSHOUSE GARDENS",
"transactions": [
{
"date": "2016-12-06",
"date": "2019-04-26",
},
],
},
Expand All @@ -176,32 +154,28 @@ exports[`GraphQL: Property propertySearchInRange [presets: perPage 2] by coordin
exports[`GraphQL: Property propertySearchInRange [presets: perPage 2] by coordinates, in miles: 2nd page 1`] = `
[
{
"paon": "56a4db1cf753ad6f5238d6aaa2ec7f60f4463768",
"address": "45c7a465a6da7fc33b9d4577cacafa53e849dda6",
"postcode": {
"lat": 51.540931,
"lng": -0.007492,
"postcode": "E20 1HR",
"lat": 51.548136,
"lng": -0.007724,
"postcode": "E20 1AB",
},
"saon": "a29e971b5176a9fadde4eb86c851c7d66de8004b",
"street": "GLASSHOUSE GARDENS",
"transactions": [
{
"date": "2016-12-02",
"date": "2019-03-25",
},
],
},
{
"paon": "56a4db1cf753ad6f5238d6aaa2ec7f60f4463768",
"address": "8b7de6d263024ec9713f5279e13aadee8d07f7c8",
"postcode": {
"lat": 51.540931,
"lng": -0.007492,
"postcode": "E20 1HR",
"lat": 51.548136,
"lng": -0.007724,
"postcode": "E20 1AB",
},
"saon": "7224f997fc148baa0b7f81c1eda6fcc3fd003db0",
"street": "GLASSHOUSE GARDENS",
"transactions": [
{
"date": "2016-11-18",
"date": "2022-09-16",
},
],
},
Expand Down
Loading