initial commit

This commit is contained in:
Luke Berndt
2024-02-02 22:09:37 -05:00
parent 75cb239a6c
commit 85864f4b84
13 changed files with 421 additions and 289 deletions

View File

@@ -62,7 +62,7 @@ exports.listUserSystems = async function (req,res,next) {
for (let index = 0; index < users.length; index++) {
let user = users[index].toObject();
const userId = new mongoose.Types.ObjectId(user._id);
const systems = await System.find({ userId: userId }, "name shortName description systemType city state county country lastActive");
const systems = await System.find({ userId: userId }, "name shortName description status systemType city state county country lastActive");
user["systems"] = systems;
list.push(user);
@@ -90,6 +90,7 @@ exports.listAllSystems = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -106,6 +107,7 @@ exports.listAllSystems = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -154,6 +156,7 @@ exports.listSystems = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -168,6 +171,7 @@ exports.listSystems = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -360,6 +364,7 @@ exports.updateSystem = async function (req, res, next) {
res.locals.system.county = res.locals.county;
res.locals.system.country = res.locals.country;
res.locals.system.description = res.locals.description;
res.locals.system.status = res.locals.status;
res.locals.system.systemType = res.locals.systemType;
res.locals.system.showScreenName = res.locals.showScreenName;
res.locals.system.allowContact = res.locals.allowContact;
@@ -378,6 +383,7 @@ exports.updateSystem = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -392,6 +398,7 @@ exports.updateSystem = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -429,7 +436,7 @@ exports.validateSystem = async function (req, res, next) {
res.locals.name = req.body.name.replace(/[^\w\s\.\,\-\_]/gi, '');
if (!req.body.description || (req.body.description.length < 2)) {
console.error("ERROR: Validate System - req.body.description");
console.error("ERROR: Validate System - req.body.description: " + req.body.description);
res.status(500)
res.json({
success: false,
@@ -437,7 +444,9 @@ exports.validateSystem = async function (req, res, next) {
});
return;
}
res.locals.description = req.body.description.replace(/[^\w\s\.\,\-\_]/gi, '');
res.locals.description = req.body.description.replace(/[^\w\s\.\,\-\_\(\)\'\"\!\?\*\&\^\%\$\#\@\r\n\t\`\~\[\]\/\\]/gi, '');
res.locals.status = req.body.status.replace(/[^\w\s\.\,\-\_\(\)\'\"\!\?\*\&\^\%\$\#\@\r\n\t\`\~\[\]\/\\]/gi, '');
if (!req.body.shortName || (req.body.shortName.length < 2)) {
console.error("ERROR: Validate System - req.body.shortName");
@@ -547,6 +556,7 @@ exports.createSystem = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -559,6 +569,7 @@ exports.createSystem = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -585,6 +596,7 @@ exports.createSystem = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,
@@ -599,6 +611,7 @@ exports.createSystem = async function (req, res, next) {
name,
shortName,
description,
status,
systemType,
city,
state,