ignore unlisted TG

This commit is contained in:
Luke Berndt
2021-04-11 08:56:33 -04:00
parent ac82b16601
commit 15dba5e89f
12 changed files with 278 additions and 3939 deletions

View File

@@ -50,7 +50,8 @@ exports.listSystems = function (req, res, next) {
country,
userId,
key,
showScreenName
showScreenName,
ignoreUnknownTalkgroup
}) => ({
name,
shortName,
@@ -62,7 +63,8 @@ exports.listSystems = function (req, res, next) {
country,
userId,
key,
showScreenName
showScreenName,
ignoreUnknownTalkgroup
}))(obj);
if (obj.showScreenName) {
rObj.screenName = req.user.screenName;
@@ -203,11 +205,7 @@ exports.ownSystem = async function (req, res, next) {
console.error("System: " + system.userId + " User: " + req.user._id);
return;
}
res.locals.test = "Yoho!"
res.locals.system = system;
console.log(system);
console.log(res.locals);
next();
} catch (err) {
@@ -280,6 +278,7 @@ exports.updateSystem = async function (req, res, next) {
res.locals.system.description = res.locals.description;
res.locals.system.systemType = res.locals.systemType;
res.locals.system.showScreenName = res.locals.showScreenName;
res.locals.system.ignoreUnknownTalkgroup = res.locals.ignoreUnknownTalkgroup;
res.locals.system.save(function (err) {
if (err) {
@@ -300,7 +299,8 @@ exports.updateSystem = async function (req, res, next) {
country,
userId,
key,
showScreenName
showScreenName,
ignoreUnknownTalkgroup
}) => ({
name,
shortName,
@@ -312,7 +312,8 @@ exports.updateSystem = async function (req, res, next) {
country,
userId,
key,
showScreenName
showScreenName,
ignoreUnknownTalkgroup
}))(res.locals.system);
returnSys.id = res.locals.system._id;
res.json({
@@ -329,7 +330,7 @@ exports.updateSystem = async function (req, res, next) {
exports.validateSystem = async function (req, res, next) {
try {
res.locals.showScreenName = req.body.showScreenName;
res.locals.ignoreUnknownTalkgroup = req.body.ignoreUnknownTalkgroup ;
if (!req.body.name || (req.body.name.length < 2)) {
console.error("ERROR: Validate System - req.body.name");
res.json({
@@ -456,7 +457,8 @@ exports.createSystem = async function (req, res, next) {
state,
county,
country,
showScreenName
showScreenName,
ignoreUnknownTalkgroup
}) => ({
name,
shortName,
@@ -466,7 +468,8 @@ exports.createSystem = async function (req, res, next) {
state,
county,
country,
showScreenName
showScreenName,
ignoreUnknownTalkgroup
}))(res.locals);
system.key = key;
system.userId = mongoose.Types.ObjectId(req.user._id);
@@ -490,6 +493,7 @@ exports.createSystem = async function (req, res, next) {
country,
userId,
showScreenName,
ignoreUnknownTalkgroup ,
key
}) => ({
name,
@@ -502,6 +506,7 @@ exports.createSystem = async function (req, res, next) {
country,
userId,
showScreenName,
ignoreUnknownTalkgroup ,
key
}))(newSys);
returnSys.id = newSys._id;