mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2024-11-25 22:01:00 +00:00
25 lines
491 B
JavaScript
25 lines
491 B
JavaScript
"use strict";
|
|
|
|
const User = require("../user/user");
|
|
|
|
const getRandomUser = callback => {
|
|
const id = Math.floor(Math.random() * 5000) + 1;
|
|
User.find(id, function (error, user) {
|
|
if (error) return getRandomUser(callback);
|
|
return callback(error, user);
|
|
})
|
|
};
|
|
|
|
const getFixedUser = (id, callback) => {
|
|
User.find(id, function (error, user) {
|
|
if (error) return getRandomUser(callback);
|
|
return callback(error, user);
|
|
})
|
|
};
|
|
|
|
module.exports = {
|
|
getRandomUser,
|
|
getFixedUser
|
|
};
|
|
|
|
|