42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
module.exports = function(){
|
|
var fakeTimeDataCount = 4000, maxUserCount = 120;
|
|
var faker = require("faker");
|
|
var _ = require("lodash");
|
|
var directions = ["in", "out"];
|
|
var users = _.times(maxUserCount, function (n)
|
|
{
|
|
return {
|
|
id: n,
|
|
//timestamp: faker.date.past(),
|
|
userId: n,
|
|
firstName: faker.name.firstName(),
|
|
lastName: faker.name.lastName()
|
|
}
|
|
}
|
|
);
|
|
var userSwipeDataPoints = _.times (fakeTimeDataCount, function(n)
|
|
{
|
|
return {
|
|
id: n,
|
|
userId: faker.random.number(maxUserCount),
|
|
timestamp: faker.date.past(),
|
|
direction: directions[faker.random.number(1)]
|
|
}
|
|
}
|
|
);
|
|
return {
|
|
userSwipeData: _.orderBy(userSwipeDataPoints, ["id"], ["asc"]),
|
|
//users: _.orderBy(data, ["userId", "asc"]),
|
|
users: _.orderBy(users, ["lastName", "firstName"],["asc", "asc"]),
|
|
//weather: _.orderBy(data, ["timestamp"],["asc"]),
|
|
stats: _.countBy(userSwipeDataPoints, "userId")
|
|
}
|
|
}
|
|
/*
|
|
so to get a list of the available users, call /users
|
|
|
|
to get specific user info, call /userSwipeData/<userId>
|
|
|
|
|
|
|
|
*/ |