Beispiel #1
0
 const findUser = (req, res, next) =>
   UserProvider.findByMaoToken({ maoToken: req.query.maoToken })
     .then(function(user) {
       console.log(user);
       req.user = user;
       return next();
     })
     .catch(err => res.status(401).send(err));
Beispiel #2
0
 app.get('/api/stats/tweet/count', (req, res) =>
   UserProvider.findByMaoToken({ maoToken: req.query.maoToken })
     .then(function(user) {
       console.log(user._id);
       const opts = {
         userObjectId: user._id,
         isRead: false,
         skip: req.query.skip - 0,
         limit: req.query.limit - 0,
       };
       return TweetProvider.aggregateTweetNumberByIllustrator(opts);
     })
     .then(data => res.send(data))
     .catch(err => res.status(401).send(err)),