Created
February 16, 2016 11:41
-
-
Save mateuszwojt/e1d779d582a475ec059b to your computer and use it in GitHub Desktop.
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
RegistrationSchema | |
.path('vin') | |
.validate(function(value, respond) { | |
var self = this; | |
return this.constructor.findOneAsync({ vin: value }) | |
.then(function(registration) { | |
if (registration) { | |
if (self.akcja === registration.akcja) { | |
return respond(false); | |
} | |
} | |
return respond(true); | |
}) | |
.catch(function(err) { | |
throw err; | |
}); | |
}, 'Ten numer VIN został już zarejestrowany w czasie trwania akcji.'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment