src/schema/query/viewer.js
function findUserFromAccessToken(accessToken, UserModel) {

    if (!accessToken) return null;

    return UserModel.findById(accessToken.userId).then((user) => {
        if (!user) return Promise.reject('No user with this access token was found.');
        return Promise.resolve(user);
    });
}
function findUserFromAccessToken(accessToken, UserModel) {

    if (!accessToken) return null;

    return UserModel.findById(accessToken.userId).then((user) => {
        if (!user) return Promise.reject('No user with this access token was found.');
        return Promise.resolve(user);
    });
}
function findUserFromAccessToken ( accessToken , UserModel ) { if ( ! accessToken ) return null ; return UserModel . findById ( accessToken . userId ) . then ( ( user ) => { if ( ! user ) return Promise . reject ( 'No user with this access token was found.' ) ; return Promise . resolve ( user ) ; } ) ; }
Finds a user from an access token
@param {*} accessToken
@param {*} UserModel
Finds a user from an access token