-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use SchemaNumberOptions class for schematype number re: #8012
- Loading branch information
Showing
4 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
const SchemaTypeOptions = require('./SchemaTypeOptions'); | ||
|
||
class SchemaNumberOptions extends SchemaTypeOptions {} | ||
|
||
const opts = { | ||
enumerable: true, | ||
configurable: true, | ||
writable: true, | ||
value: null | ||
}; | ||
|
||
/** | ||
* If set, Mongoose adds a validator that checks that this path is at least the | ||
* given `min`. | ||
* | ||
* @api public | ||
* @property min | ||
* @memberOf SchemaNumberOptions | ||
* @type Number | ||
* @instance | ||
*/ | ||
|
||
Object.defineProperty(SchemaNumberOptions.prototype, 'min', opts); | ||
|
||
/** | ||
* If set, Mongoose adds a validator that checks that this path is at least the | ||
* given `max`. | ||
* | ||
* @api public | ||
* @property max | ||
* @memberOf SchemaNumberOptions | ||
* @type Number | ||
* @instance | ||
*/ | ||
|
||
Object.defineProperty(SchemaNumberOptions.prototype, 'max', opts); | ||
|
||
/*! | ||
* ignore | ||
*/ | ||
|
||
module.exports = SchemaNumberOptions; |
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
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
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