Skip to content

Instantly share code, notes, and snippets.

@mateuszwojt
Created February 16, 2016 11:41
Show Gist options
  • Save mateuszwojt/e1d779d582a475ec059b to your computer and use it in GitHub Desktop.
Save mateuszwojt/e1d779d582a475ec059b to your computer and use it in GitHub Desktop.
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