Comparing version 0.0.2 to 0.0.3
@@ -27,4 +27,5 @@ /** | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @override | ||
*/ | ||
Entity.prototype.create = function(itemData, done) { | ||
Entity.prototype._create = function(itemData, done) { | ||
var item = new this.Model(itemData); | ||
@@ -39,4 +40,5 @@ item.save(done); | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @override | ||
*/ | ||
Entity.prototype.readOne = function(id, done) { | ||
Entity.prototype._readOne = function(id, done) { | ||
var query = new Object(null); | ||
@@ -59,4 +61,5 @@ | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @override | ||
*/ | ||
Entity.prototype.read = function(optQuery, done) { | ||
Entity.prototype._read = function(optQuery, done) { | ||
var query = {}; | ||
@@ -79,4 +82,5 @@ if (__.isFunction(optQuery)) { | ||
* @param {Function(ts.error.Abstract=, Array.<mongoose.Document>=)} done callback. | ||
* @override | ||
*/ | ||
Entity.prototype.readLimit = function(query, skip, limit, done) { | ||
Entity.prototype._readLimit = function(query, skip, limit, done) { | ||
this.Model.find(query) | ||
@@ -93,4 +97,5 @@ .skip(skip) | ||
* @param {Function(ts.error.Abstract=, number=)} done callback. | ||
* @override | ||
*/ | ||
Entity.prototype.count = function(query, done) { | ||
Entity.prototype._count = function(query, done) { | ||
this.Model.count(query).exec(done); | ||
@@ -105,4 +110,5 @@ }; | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @override | ||
*/ | ||
Entity.prototype.update = function(id, itemData, done) { | ||
Entity.prototype._update = function(id, itemData, done) { | ||
this.Model.findById(id, function(err, doc){ | ||
@@ -109,0 +115,0 @@ if (err) { |
@@ -5,2 +5,4 @@ /** | ||
var midd = require('middlewarify'); | ||
/** | ||
@@ -19,2 +21,11 @@ * The base Entity Class all entities extend from. | ||
this.udo = optUdo || null; | ||
// Create primitive middlewares | ||
midd.make(this, 'create', this._create); | ||
midd.make(this, 'read', this._read); | ||
midd.make(this, 'readOne', this._readOne); | ||
midd.make(this, 'readLimit', this._readLimit); | ||
midd.make(this, 'update', this._update); | ||
midd.make(this, 'delete', this._delete ); | ||
midd.make(this, 'count', this._count); | ||
}; | ||
@@ -35,4 +46,5 @@ | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @protected | ||
*/ | ||
Entity.prototype.create = function(itemData, done) { | ||
Entity.prototype._create = function(itemData, done) { | ||
throw new Error('Not Implemented'); | ||
@@ -46,4 +58,5 @@ }; | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @protected | ||
*/ | ||
Entity.prototype.readOne = function(id, done) { | ||
Entity.prototype._readOne = function(id, done) { | ||
throw new Error('Not Implemented'); | ||
@@ -58,4 +71,5 @@ }; | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @protected | ||
*/ | ||
Entity.prototype.read = function(optQuery, done) { | ||
Entity.prototype._read = function(optQuery, done) { | ||
throw new Error('Not Implemented'); | ||
@@ -71,4 +85,5 @@ }; | ||
* @param {Function(ts.error.Abstract=, Array.<mongoose.Document>=)} done callback. | ||
* @protected | ||
*/ | ||
Entity.prototype.readLimit = function(query, skip, limit, done) { | ||
Entity.prototype._readLimit = function(query, skip, limit, done) { | ||
throw new Error('Not Implemented'); | ||
@@ -82,4 +97,5 @@ }; | ||
* @param {Function(ts.error.Abstract=, number=)} done callback. | ||
* @protected | ||
*/ | ||
Entity.prototype.count = function(query, done) { | ||
Entity.prototype._count = function(query, done) { | ||
throw new Error('Not Implemented'); | ||
@@ -94,4 +110,5 @@ }; | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @protected | ||
*/ | ||
Entity.prototype.update = function(id, itemData, done) { | ||
Entity.prototype._update = function(id, itemData, done) { | ||
throw new Error('Not Implemented'); | ||
@@ -105,6 +122,7 @@ }; | ||
* @param {Function(ts.error.Abstract=, mongoose.Document=)} done callback. | ||
* @protected | ||
*/ | ||
Entity.prototype.delete = function(id, done) { | ||
Entity.prototype._delete = function(id, done) { | ||
throw new Error('Not Implemented'); | ||
}; | ||
{ | ||
"name": "crude", | ||
"description": "Seamless CRUD control operations for node.", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "https://github.com/talksession/node-crude", | ||
@@ -38,3 +38,4 @@ "author": { | ||
"async": "~0.2.9", | ||
"mime": "~1.2.9" | ||
"mime": "~1.2.9", | ||
"middlewarify": "~0.0.2" | ||
}, | ||
@@ -46,3 +47,4 @@ "devDependencies": { | ||
"grunt": "~0.4.1", | ||
"grunt-release": "~0.3.5" | ||
"grunt-release": "~0.3.5", | ||
"mongoose": "~3.6.14" | ||
}, | ||
@@ -49,0 +51,0 @@ "keywords": [ |
@@ -26,3 +26,2 @@ # node-crude | ||
## Authors | ||
@@ -33,3 +32,7 @@ | ||
## Release History | ||
- **v0.0.1**, *21 Jun 2013* | ||
- **v0.0.3**, *15 Jul 2013* | ||
- Integrated [Middlewarify](https://github.com/thanpolas/middlewarify) and made all Entity primitive methods middleware. | ||
- Added Entity tests | ||
- **v0.0.2**, *21 Jun 2013* | ||
- Big Bang | ||
@@ -36,0 +39,0 @@ |
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
46679
25
1214
49
7
6
+ Addedmiddlewarify@~0.0.2
+ Addedmiddlewarify@0.0.4(transitive)