Comparing version 0.4.1 to 0.4.2
@@ -35,2 +35,9 @@ ## [Unreleased] | ||
## [0.4.2] - 2017-12-27 | ||
### Fixed | ||
* Documentation about static methods, parameters 'connection' and 'tenant' were missing. | ||
* Order of Schema fields validate function. | ||
## [0.4.1] - 2017-12-27 | ||
@@ -235,2 +242,3 @@ | ||
[0.4.2]: https://github.com/Yonirt/moltyjs/compare/v0.4.1...v0.4.2 | ||
[0.4.1]: https://github.com/Yonirt/moltyjs/compare/v0.4.0...v0.4.1 | ||
@@ -237,0 +245,0 @@ [0.4.0]: https://github.com/Yonirt/moltyjs/compare/v0.3.0...v0.4.0 |
@@ -243,3 +243,3 @@ 'use strict'; | ||
// Custom validation | ||
if (typeof schema[key].validate === 'function' && !schema[key].validate(payload[key], tenant, mongoClient)) { | ||
if (typeof schema[key].validate === 'function' && !schema[key].validate(mongoClient, tenant, payload[key])) { | ||
throw new Error('Value assigned to ' + key + ' failed custom validator. Value was ' + payload[key]); | ||
@@ -246,0 +246,0 @@ } |
{ | ||
"name": "moltyjs", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "A tiny ODM for MongoDB with multy tenancy support.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -122,3 +122,3 @@ [![npm version](https://badge.fury.io/js/moltyjs.svg)](https://badge.fury.io/js/moltyjs) | ||
type: String, | ||
validate: async (value, tenant, connection) => { | ||
validate: async (connection, tenant, value) => { | ||
const exists = await connection.find(tenant, 'TestModel', { | ||
@@ -150,3 +150,7 @@ job: value, | ||
```javascript | ||
newSchema.methods.comparePassword = async function(candidatePassword) { | ||
newSchema.methods.comparePassword = async function( | ||
connection, | ||
tenant, | ||
candidatePassword, | ||
) { | ||
const user = this._data; | ||
@@ -153,0 +157,0 @@ return candidatePassword === user.password; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79082
452