Skip to content

Commit

Permalink
removed mandatory usertype
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq89 committed Oct 5, 2016
1 parent 56993c2 commit 6daf21b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions queryMaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ module.exports = {
$lt: new Date(params.query.enddate),
};
return dynObj;
} else if ((params.query.usertype === "USER" || params.query.usertype === "ENTERPRISE")
&& params.query.username) {
} else if (params.query.username) {
return {
"User.UserName" : params.query.username,
"CreateTime" : {
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var assert = require('assert');
var MongoClient = require('mongodb').MongoClient;
var url = 'mongodb://gofetch.cloudapp.net:27017/taskcat';

var port = process.env.PORT || 8080;
var port = process.env.PORT || 80;
var router = express.Router();

app.use(bodyParser.urlencoded({ extended: true }));
Expand Down
9 changes: 1 addition & 8 deletions utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ module.exports = {

if (!params.query.startdate) return {msg: "'startdate' is not available", valid: false}
else if (!params.query.enddate) return {msg: "'enddate' is not available", valid: false}
else if (!params.query.usertype && params.query.userid.length !== 24) return {msg: "'userid' is not available", valid: false}
else if (!params.query.usertype && !params.query.userid) return {msg: "'usertype' is not available", valid: false}
else if (params.query.userid && params.query.userid.length !== 24) return {msg: "'userid' is not available", valid: false}
else if (!params.query.startdate.match(isoDateRegex))
return {
msg: "startdate '"+params.query.startdate+"' is not in proper ISO date format, ex: 2016-09-19T17:59:59.000Z",
Expand All @@ -16,12 +15,6 @@ module.exports = {
msg: "enddate '"+params.query.enddate+"' is not in proper ISO date format, ex: 2016-09-19T17:59:59.000Z",
valid: false
};
else if (params.query.usertype != "ENTERPRISE" && params.query.usertype != "USER"
&& params.query.usertype != "BIKE_MESSENGER" && params.query.usertype != undefined)
return {
msg: "usertype must be either ENTERPRISE or just USER!",
valid: false
}
else return {valid: true};
},

Expand Down

0 comments on commit 6daf21b

Please sign in to comment.