Skip to content

Commit

Permalink
Merge pull request #190 from davellanedam/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
davellanedam authored Jan 12, 2020
2 parents 253d29b + ba320bc commit 324544f
Show file tree
Hide file tree
Showing 5 changed files with 1,784 additions and 3,371 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ typings/

# ignore production configuration
.env.production

.history/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v7.1.2 (January 12, 2020)

- Added cross-env to solve windows envionment issues
- Use Mongoose built in function to validate ID
- NPM updated

## v7.1.1 (September 29, 2019)

- Added new option MongoClient constructor
Expand Down
3 changes: 2 additions & 1 deletion app/middleware/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const mongoose = require('mongoose')
const requestIp = require('request-ip')
const { validationResult } = require('express-validator')

Expand Down Expand Up @@ -96,7 +97,7 @@ exports.buildSuccObject = message => {
*/
exports.isIDGood = async id => {
return new Promise((resolve, reject) => {
const goodID = String(id).match(/^[0-9a-fA-F]{24}$/)
const goodID = mongoose.Types.ObjectId.isValid(id)
return goodID
? resolve(id)
: reject(this.buildErrObject(422, 'ID_MALFORMED'))
Expand Down
Loading

0 comments on commit 324544f

Please sign in to comment.