Skip to content
Browse files

a complete change of validation rules (see new [rule-validator](https…

  • Loading branch information...
1 parent acd28ea commit a9c689fdd72f38008d082c6114d037af8c25d9e0 @adrai committed
Showing with 9 additions and 15 deletions.
  1. +4 −0 README.md
  2. +3 −13 lib/bases/commandHandlerBase.js
  3. +2 −2 package.json
View
4 README.md
@@ -78,6 +78,10 @@ See [tests](https://github.com/adrai/node-cqrs-domain/tree/master/test) for deta
# Release Notes
+## v0.5.0
+
+- a complete change of validation rules (see new [rule-validator](https://github.com/adrai/rule-validator))
+
## v0.4.4
- added disableQueuing flag
View
16 lib/bases/commandHandlerBase.js
@@ -100,17 +100,7 @@ CommandHandler.prototype = {
validate: function(ruleName, data, callback) {
if(this.validationRules && this.validationRules[ruleName]) {
- this.validationRules[ruleName].validate(data, function(err) {
- if (err) {
- var keys = _.toArray(err);
- _.each(keys, function(key) {
- key.type = 'validationRule';
- });
- callback(keys);
- } else {
- callback(null);
- }
- });
+ this.validationRules[ruleName].validate(data, callback);
} else {
callback(null);
}
@@ -131,7 +121,7 @@ CommandHandler.prototype = {
next(null, evt.payload);
}, function(err, events) {
aggregate.loadFromHistory(snapshot.data, events);
- callback(null, aggregate, stream);
+ callback(null, aggregate, stream);
});
});
},
@@ -141,7 +131,7 @@ CommandHandler.prototype = {
},
checkRevision: function(cmd, aggRev, callback) {
- if(!cmd.head || cmd.head.revision === undefined ||
+ if(!cmd.head || cmd.head.revision === undefined ||
(cmd.head && cmd.head.revision === aggRev)) {
return callback(null);
}
View
4 package.json
@@ -1,7 +1,7 @@
{
"author": "adrai",
"name": "cqrs-domain",
- "version": "0.4.4",
+ "version": "0.5.0",
"private": false,
"main": "index.js",
"engines": {
@@ -24,7 +24,7 @@
"devDependencies": {
"mocha": ">= 1.0.1",
"expect.js": ">= 0.1.2",
- "rule-validator": ">= 0.2.0"
+ "rule-validator": ">= 0.3.1"
},
"description": "Node-cqrs-domain is a node.js module based on nodeEventStore. It can be very useful as domain component if you work with (d)ddd, cqrs, eventdenormalizer, host, etc.",
"keywords": [

0 comments on commit a9c689f

Please sign in to comment.
Something went wrong with that request. Please try again.