File tree 5 files changed +1784
-3371
lines changed
5 files changed +1784
-3371
lines changed Original file line number Diff line number Diff line change @@ -67,3 +67,5 @@ typings/
67
67
68
68
# ignore production configuration
69
69
.env.production
70
+
71
+ .history /
Original file line number Diff line number Diff line change
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
+
1
7
## v7.1.1 (September 29, 2019)
2
8
3
9
- Added new option MongoClient constructor
Original file line number Diff line number Diff line change
1
+ const mongoose = require ( 'mongoose' )
1
2
const requestIp = require ( 'request-ip' )
2
3
const { validationResult } = require ( 'express-validator' )
3
4
@@ -96,7 +97,7 @@ exports.buildSuccObject = message => {
96
97
*/
97
98
exports . isIDGood = async id => {
98
99
return new Promise ( ( resolve , reject ) => {
99
- const goodID = String ( id ) . match ( / ^ [ 0 - 9 a - f A - F ] { 24 } $ / )
100
+ const goodID = mongoose . Types . ObjectId . isValid ( id )
100
101
return goodID
101
102
? resolve ( id )
102
103
: reject ( this . buildErrObject ( 422 , 'ID_MALFORMED' ) )
You can’t perform that action at this time.
0 commit comments