Created
June 24, 2019 14:15
-
-
Save Ratstail91/b5b7519a1d3fb25d68010c88fb906472 to your computer and use it in GitHub Desktop.
Literally all of my functions look like this!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const validateTokenCredentials = (connection) => (fields) => new Promise( (resolve, reject) => { | |
const validateQuery = 'SELECT COUNT(*) AS total FROM sessions WHERE sessions.accountId = ? AND sessions.token = ?;'; | |
return connection.query(validateQuery, [fields.id, fields.token]) | |
.then(results => results[0].total > 0 ? resolve(fields) : reject({msg: 'Invalid password change credentials', extra: [fields.id, fields.token]})) | |
; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment