'use strict';

import models      from '../../models';
import { GENERIC } from '../../utils/errorTypes.js';

let User = models.User;

export default function resolveUser(req, res, next)  {
    let jwtUserId = req.user.id;

    User.findById(jwtUserId)
        .then(function (loggedInUser) {
            if (!loggedInUser) {
                res.err(404, 'User not found!')
            } else {
                req.user = loggedInUser;
                return next();
            }
        })
        .catch(function (err) {
            res.err(500)
        })
};


@@ -428,16 +428,40 @@
 InUser;%0A
+                next();%0A
         
@@ -476,21 +476,19 @@
 return n
-ext()
+ull
 ;%0A      

Return null from resolveuser since it seems to confuse bluebird