Skip to content

Commit 324544f

Browse files
authored
Merge pull request #190 from davellanedam/development
Development
2 parents 253d29b + ba320bc commit 324544f

File tree

5 files changed

+1784
-3371
lines changed

5 files changed

+1784
-3371
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ typings/
6767

6868
# ignore production configuration
6969
.env.production
70+
71+
.history/

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v7.1.2 (January 12, 2020)
2+
3+
- Added cross-env to solve windows envionment issues
4+
- Use Mongoose built in function to validate ID
5+
- NPM updated
6+
17
## v7.1.1 (September 29, 2019)
28

39
- Added new option MongoClient constructor

app/middleware/utils.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const mongoose = require('mongoose')
12
const requestIp = require('request-ip')
23
const { validationResult } = require('express-validator')
34

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

0 commit comments

Comments
 (0)