UNPKG

node-express-mongodb-jwt-rest-api-skeleton

Version:

Node.js express.js MongoDB JWT REST API - This is a basic API REST skeleton written on JavaScript using async/await. Great for building a starter web API for your front-end (Android, iOS, Vue, react, angular, or anything that can consume an API)

17 lines (14 loc) 416 B
const { buildErrObject } = require('../../../middleware/utils') /** * Checks if blockExpires from user is greater than now * @param {Object} user - user object */ const userIsBlocked = (user = {}) => { return new Promise((resolve, reject) => { if (user.blockExpires > new Date()) { return reject(buildErrObject(409, 'BLOCKED_USER')) } resolve(true) }) } module.exports = { userIsBlocked }