Skip to content

Commit

Permalink
Update Dependencies (#431)
Browse files Browse the repository at this point in the history
* #365 Separate out dev deps in package.json

* Closer but webapck is broken

* Dev server works - build still broken

* Fix build

* Update Expressjs
  • Loading branch information
tariqksoliman authored Oct 3, 2023
1 parent 2de964c commit b7d08e9
Show file tree
Hide file tree
Showing 18 changed files with 28,289 additions and 28,195 deletions.
2 changes: 1 addition & 1 deletion API/Backend/Config/routes/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ router.get("/missions", function (req, res, next) {
.query(
"SELECT DISTINCT ON (mission) mission, version, config FROM configs ORDER BY mission ASC"
)
.spread((results) => {
.then(([results]) => {
res.send({ status: "success", missions: results });
return null;
})
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Datasets/models/datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function makeNewDatasetTable(name, columns, success, failure) {
} else {
sequelize
.query("SELECT COUNT(*) FROM datasets")
.spread((results) => {
.then(([results]) => {
let newTable = "d" + (parseInt(results[0].count) + 1) + "_datasets";
Datasets.create({
name: name,
Expand Down
4 changes: 2 additions & 2 deletions API/Backend/Datasets/routes/datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function get(req, res, next) {
},
}
)
.spread((r) => {
.then(([r]) => {
results.push({
...queries[i],
table: result.dataValues.table,
Expand Down Expand Up @@ -130,7 +130,7 @@ router.post("/search", function (req, res, next) {
},
}
)
.spread((results) => {
.then(([results]) => {
let r = [];
for (let i = 0; i < results.length; i++) {
let feature = JSON.parse(results[i].st_asgeojson);
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Draw/models/userfiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const makeMasterFiles = (intents) => {
public: "1",
hidden: "0",
},
}).spread(function (userResult, created) {
}).then(function ([userResult, created]) {
// userResult is the user instance

if (created) {
Expand Down
10 changes: 5 additions & 5 deletions API/Backend/Draw/routes/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ const clipOver = function (
added_id: added_id,
},
})
.spread((results) => {
.then(([results]) => {
let oldIds = [];
let newIds = [added_id];

Expand Down Expand Up @@ -383,7 +383,7 @@ const clipUnder = function (
geom: JSON.stringify(newFeature.geom),
},
})
.spread((results) => {
.then(([results]) => {
let oldIds = [];
let newIds = [];

Expand Down Expand Up @@ -1351,7 +1351,7 @@ router.post("/merge", function (req, res, next) {
file_id: req.body.file_id,
},
})
.spread((results) => {
.then(([results]) => {
let oldIds = req.body.ids.map(function (id) {
return parseInt(id, 10);
});
Expand Down Expand Up @@ -1511,7 +1511,7 @@ router.post("/split", function (req, res, next) {
geom: JSON.stringify(geom),
},
})
.spread((results) => {
.then(([results]) => {
//reformat results
let r = [];
for (var i = 0; i < results.length; i++) {
Expand Down Expand Up @@ -1754,7 +1754,7 @@ const makeMasterFilesTEST = (leadGroupName, callback) => {
public: "1",
hidden: "0",
},
}).spread(function (userResult, created) {
}).then(function ([userResult, created]) {
makeMasterFileTEST(i + 1, Table);
return null;
});
Expand Down
8 changes: 4 additions & 4 deletions API/Backend/Draw/routes/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ const compile = function (req, res, callback) {
" " +
"FETCH first 1 rows only"
)
.spread((results) => {
.then(([results]) => {
let bestHistory = results.length > 0 ? results[0].history : [];
featureIds = featureIds.concat(bestHistory);
finished++;
Expand All @@ -664,7 +664,7 @@ const compile = function (req, res, callback) {
featureIds +
")"
)
.spread((features) => {
.then(([features]) => {
processFeatures(features);
});
}
Expand Down Expand Up @@ -726,7 +726,7 @@ const compile = function (req, res, callback) {
" " +
"AND ST_Contains(a.geom, b.geom)"
)
.spread((results) => {
.then(([results]) => {
let hierarchy = [];
let intentOrder = ["roi", "campaign", "campsite", "signpost"];
let excludeIntents = ["polygon", "line", "point", "text", "arrow"];
Expand Down Expand Up @@ -1236,7 +1236,7 @@ const compile = function (req, res, callback) {
},
}
)
.spread((published_family_tree) => {
.then(([published_family_tree]) => {
if (
!published_family_tree ||
!published_family_tree[0] ||
Expand Down
6 changes: 3 additions & 3 deletions API/Backend/Draw/routes/filesutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getfile(req, res, next) {
},
}
)
.spread((results) => {
.then(([results]) => {
let geojson = { type: "FeatureCollection", features: [] };
for (let i = 0; i < results.length; i++) {
let properties = results[i].properties;
Expand Down Expand Up @@ -146,7 +146,7 @@ function getfile(req, res, next) {
},
}
)
.spread((results) => {
.then(([results]) => {
let bestHistory = [];
for (let i = 0; i < results.length; i++) {
bestHistory = bestHistory.concat(results[i].history);
Expand Down Expand Up @@ -176,7 +176,7 @@ function getfile(req, res, next) {
},
}
)
.spread((results) => {
.then(([results]) => {
let geojson = { type: "FeatureCollection", features: [] };
for (let i = 0; i < results.length; i++) {
let properties = JSON.parse(results[i].properties);
Expand Down
54 changes: 27 additions & 27 deletions API/Backend/Geodatasets/models/geodatasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ const attributes = {
name: {
type: Sequelize.STRING,
unique: true,
allowNull: false
allowNull: false,
},
table: {
type: Sequelize.STRING,
unique: true,
allowNull: false
}
allowNull: false,
},
};

const options = {
timestamps: true
timestamps: true,
};

// setup User model and its fields.
Expand All @@ -32,25 +32,25 @@ function makeNewGeodatasetTable(name, success, failure) {
properties: {
type: Sequelize.JSON,
allowNull: true,
defaultValue: {}
defaultValue: {},
},
geometry_type: {
type: Sequelize.STRING,
unique: false,
allowNull: false
allowNull: false,
},
geom: {
type: Sequelize.GEOMETRY,
allowNull: true
}
allowNull: true,
},
};

const options = {
timestamps: false
timestamps: false,
};

Geodatasets.findOne({ where: { name: name } })
.then(result => {
.then((result) => {
if (result) {
let GeodatasetTable = sequelize.define(
result.dataValues.table,
Expand All @@ -61,16 +61,16 @@ function makeNewGeodatasetTable(name, success, failure) {
{ updatedAt: new Date().toISOString() },
{ where: { name: name }, silent: true }
)
.then(r => {
.then((r) => {
success({
name: result.dataValues.name,
table: result.dataValues.table,
tableObj: GeodatasetTable
tableObj: GeodatasetTable,
});

return null;
})
.catch(err => {
.catch((err) => {
logger(
"error",
"Failed to update geodatasets.",
Expand All @@ -80,20 +80,20 @@ function makeNewGeodatasetTable(name, success, failure) {
);
failure({
status: "failure",
message: "Failed to update geodatasets"
message: "Failed to update geodatasets",
});
});
} else {
sequelize
.query("SELECT COUNT(*) FROM geodatasets")
.spread(results => {
.then(([results]) => {
let newTable =
"g" + (parseInt(results[0].count) + 1) + "_geodatasets";
Geodatasets.create({
name: name,
table: newTable
table: newTable,
})
.then(created => {
.then((created) => {
let GeodatasetTable = sequelize.define(
newTable,
attributes,
Expand All @@ -105,11 +105,11 @@ function makeNewGeodatasetTable(name, success, failure) {
success({
name: name,
table: newTable,
tableObj: GeodatasetTable
tableObj: GeodatasetTable,
});
return null;
})
.catch(err => {
.catch((err) => {
logger(
"error",
"Failed to sync geodataset table.",
Expand All @@ -119,13 +119,13 @@ function makeNewGeodatasetTable(name, success, failure) {
);
failure({
status: "failure",
message: "Failed to sync"
message: "Failed to sync",
});
});

return null;
})
.catch(err => {
.catch((err) => {
logger(
"error",
"Failed to create geodataset table.",
Expand All @@ -135,12 +135,12 @@ function makeNewGeodatasetTable(name, success, failure) {
);
failure({
status: "failure",
message: "Failed to create"
message: "Failed to create",
});
});
return null;
})
.catch(err => {
.catch((err) => {
logger(
"error",
"Failed to count existing geodatasets.",
Expand All @@ -150,14 +150,14 @@ function makeNewGeodatasetTable(name, success, failure) {
);
failure({
status: "failure",
message: "Failed to count existing geodatasets"
message: "Failed to count existing geodatasets",
});
});
}

return null;
})
.catch(err => {
.catch((err) => {
logger(
"error",
"Failed to find existing geodatasets.",
Expand All @@ -169,13 +169,13 @@ function makeNewGeodatasetTable(name, success, failure) {
status: "failure",
message: "Failed to find existing geodatasets",
error: error,
name: name
name: name,
});
});
}

// export User model for use in other files.
module.exports = {
Geodatasets: Geodatasets,
makeNewGeodatasetTable: makeNewGeodatasetTable
makeNewGeodatasetTable: makeNewGeodatasetTable,
};
6 changes: 3 additions & 3 deletions API/Backend/Geodatasets/routes/geodatasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function get(reqtype, req, res, next) {
.query(
"SELECT properties, ST_AsGeoJSON(geom)" + " " + "FROM " + table
)
.spread((results) => {
.then(([results]) => {
let geojson = { type: "FeatureCollection", features: [] };
for (let i = 0; i < results.length; i++) {
let properties = results[i].properties;
Expand Down Expand Up @@ -155,7 +155,7 @@ function get(reqtype, req, res, next) {
},
}
)
.spread((results) => {
.then(([results]) => {
res.setHeader("Content-Type", "application/x-protobuf");
res.setHeader("Access-Control-Allow-Origin", "*");

Expand Down Expand Up @@ -254,7 +254,7 @@ router.post("/search", function (req, res, next) {
},
}
)
.spread((results) => {
.then(([results]) => {
let r = [];
for (let i = 0; i < results.length; i++) {
let feature = JSON.parse(results[i].st_asgeojson);
Expand Down
8 changes: 4 additions & 4 deletions API/Backend/Webhooks/processes/triggerwebhooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ function drawFileUpdate(webhook, payload) {
response.send = function (res) {
const webhookHeader = JSON.parse(webhook.header);
const webhookBody = JSON.parse(webhook.body);
const file_name = res.body?.file[0]?.file_name || null;
const file_owner = res.body?.file[0]?.file_owner || null;
const file_name = res.body?.file?.[0]?.file_name || null;
const file_owner = res.body?.file?.[0]?.file_owner || null;
const geojson = res.body.geojson;

const injectableVariables = {
Expand Down Expand Up @@ -148,8 +148,8 @@ function drawFileDelete(webhook, payload) {
const webhookHeader = JSON.parse(webhook.header);
const webhookBody = JSON.parse(webhook.body);
const geojson = res.body.geojson;
const file_name = res.body?.file[0]?.file_name || null;
const file_owner = res.body?.file[0]?.file_owner || null;
const file_name = res.body?.file?.[0]?.file_name || null;
const file_owner = res.body?.file?.[0]?.file_owner || null;

const injectableVariables = {
file_id,
Expand Down
Loading

0 comments on commit b7d08e9

Please sign in to comment.