added userstest endpoint to respond with an object with embedded array, this makes knockout binding easier for SPA.

This commit is contained in:
Chris.Watts90@outlook.com 2017-01-27 09:28:30 +00:00
parent f625396537
commit 7c8dd36605

View File

@ -3,7 +3,7 @@ module.exports = function(){
var faker = require("faker"); var faker = require("faker");
var _ = require("lodash"); var _ = require("lodash");
var directions = ["in", "out"]; var directions = ["in", "out"];
var users = _.times(maxUserCount, function (n) var usersData = _.times(maxUserCount, function (n)
{ {
return { return {
id: n, id: n,
@ -24,12 +24,16 @@ module.exports = function(){
} }
} }
); );
var userDataObject = {users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"])};
return { return {
userSwipeData: _.orderBy(userSwipeDataPoints, ["id"], ["asc"]), userSwipeData: _.orderBy(userSwipeDataPoints, ["id"], ["asc"]),
//users: _.orderBy(data, ["userId", "asc"]), //users: _.orderBy(data, ["userId", "asc"]),
users: _.orderBy(users, ["lastName", "firstName"],["asc", "asc"]), users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"]),
//weather: _.orderBy(data, ["timestamp"],["asc"]), //weather: _.orderBy(data, ["timestamp"],["asc"]),
stats: _.countBy(userSwipeDataPoints, "userId") stats: _.countBy(userSwipeDataPoints, "userId"),
userstest: {
users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"])
}
} }
} }
/* /*