@janiscommerce/model-controller
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -7,2 +7,7 @@ # Changelog | ||
## [1.4.0] - 2019-06-24 | ||
### Added | ||
- `Controller` - insert, save, update methods | ||
- `Model` - insert, save, update methods | ||
## [1.3.0] - 2019-06-21 | ||
@@ -9,0 +14,0 @@ ### Added |
@@ -97,4 +97,60 @@ 'use strict'; | ||
} | ||
async getTotals() { | ||
return this | ||
.getModel() | ||
.getTotals(); | ||
} | ||
async insert(item) { | ||
return this | ||
.getModel() | ||
.insert(item); | ||
} | ||
async save(item) { | ||
return this | ||
.getModel() | ||
.save(item); | ||
} | ||
async update(values, filter) { | ||
return this | ||
.getModel() | ||
.update(values, filter); | ||
} | ||
async remove(item) { | ||
return this | ||
.getModel() | ||
.remove(item); | ||
} | ||
async multiInsert(items) { | ||
return this | ||
.getModel() | ||
.multiInsert(items); | ||
} | ||
async multiSave(items) { | ||
return this | ||
.getModel() | ||
.multiSave(items); | ||
} | ||
async multiRemove(filter) { | ||
return this | ||
.getModel() | ||
.multiRemove(filter); | ||
} | ||
} | ||
module.exports = Controller; |
@@ -43,7 +43,39 @@ 'use strict'; | ||
async get(params = {}) { | ||
return this.db.get(params); | ||
return this.db.get(this, params); | ||
} | ||
async getTotals() { | ||
return this.db.getTotals(this); | ||
} | ||
async insert(item) { | ||
return this.db.insert(this, item); | ||
} | ||
async save(item) { | ||
return this.db.save(this, item); | ||
} | ||
async update(values, filter) { | ||
return this.db.update(this, values, filter); | ||
} | ||
async remove(item) { | ||
return this.db.remove(this, item); | ||
} | ||
async multiInsert(items) { | ||
return this.db.multiInsert(this, items); | ||
} | ||
async multiSave(items) { | ||
return this.db.multiSave(this, items); | ||
} | ||
async multiRemove(filter) { | ||
return this.db.multiRemove(this, filter); | ||
} | ||
} | ||
module.exports = Model; |
{ | ||
"name": "@janiscommerce/model-controller", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "The `model-controller` module allows you to get a controller/model class or instance easily", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"test": "export TEST_ENV=true; mocha --exit -R nyan --recursive tests/", | ||
"watch-test": "export TEST_ENV=true; mocha --exit -R nyan -w --recursive", | ||
"watch-test": "export TEST_ENV=true; mocha --exit -R nyan -w --recursive tests/", | ||
"test-ci": "nyc --reporter=html --reporter=text mocha --recursive tests/", | ||
@@ -11,0 +11,0 @@ "coverage": "nyc npm test", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10447
224
0