module.exports = function(){ var fakeTimeDataCount = 4000, maxUserCount = 120, unassignedCardCount = 4, maxValidCardCount = 150; var faker = require("faker"); var _ = require("lodash"); var directions = ["in", "out"]; var validCards = _.times(maxValidCardCount, function(n){ return{ id:n, Id:n, UserId_FK: faker.random.number(maxUserCount), IsSelected: true, CardUId: faker.random.uuid() }; }); var usersData = _.times(maxUserCount, function (n) { return { id: n, //needed for the /users/id endpoint Id: n, UserId: n, FirstName: faker.name.firstName(), LastName: faker.name.lastName(), HoursPerWeek: 37.0, AssociatedCardCount: _.filter(validCards, {'UserId_FK': n}).length, AssociatedCards: _.filter(validCards, {'UserId_FK': n}) } } ); var userSwipeDataPoints = _.times (fakeTimeDataCount, function(n) { return { id: n, Id: n, UserId: faker.random.number(maxUserCount), Timestamp: faker.date.past(), Direction: directions[faker.random.number(1)] } } ); //var userDataObject = {users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"])}; var unassignedTestCards = _.times(unassignedCardCount, function(n) { return { id: n, Id: n, UserId: -1, IsSelected: false, //needed for knockout checked binding. CardUId: faker.random.uuid() } }); return { timelogs: _.orderBy(userSwipeDataPoints, ["id"], ["asc"]), //users: _.orderBy(data, ["userId", "asc"]), users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"]), //weather: _.orderBy(data, ["timestamp"],["asc"]), stats: _.countBy(userSwipeDataPoints, "userId"), timelogtest: { Logs: _.orderBy(userSwipeDataPoints, "Timestamp", "asc") }, userstest: { UserCount: maxUserCount, Users: _.orderBy(usersData, ["lastName", "firstName"],["asc", "asc"]) }, unassignedCards: { data: unassignedTestCards} } } /* so to get a list of the available users, call /users to get specific user info, call /userSwipeData/ */