Skip to content

Commit 793ed96

Browse files
authored
make params optional (#146)
1 parent d1b97f5 commit 793ed96

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ class Service extends AdapterService {
519519
* `find` service function for Objection.
520520
* @param params
521521
*/
522-
_find (params) {
522+
_find (params = {}) {
523523
const find = (params, count, filters, query) => {
524524
const q = params.objection || this.createQuery(params);
525525
const groupByColumns = this.getGroupByColumns(q);
@@ -599,7 +599,7 @@ class Service extends AdapterService {
599599
return result;
600600
}
601601

602-
_get (id, params) {
602+
_get (id, params = {}) {
603603
// merge user query with the 'id' to get
604604
const findQuery = Object.assign({}, { $and: [] }, params.query);
605605
findQuery.$and.push(this.getIdsQuery(id));
@@ -695,7 +695,7 @@ class Service extends AdapterService {
695695
* @param {object} data
696696
* @param {object} params
697697
*/
698-
async _create (data, params) {
698+
async _create (data, params = {}) {
699699
const transaction = await this._createTransaction(params);
700700
const q = this._createQuery(params);
701701
let promise = q;
@@ -725,7 +725,7 @@ class Service extends AdapterService {
725725
* @param data
726726
* @param params
727727
*/
728-
_update (id, data, params) {
728+
_update (id, data, params = {}) {
729729
// NOTE : First fetch the item to update to account for user query
730730
return this._get(id, params)
731731
.then(() => {
@@ -790,7 +790,7 @@ class Service extends AdapterService {
790790
* @param data
791791
* @param params
792792
*/
793-
_patch (id, data, params) {
793+
_patch (id, data, params = {}) {
794794
let { filters, query } = this.filterQuery(params);
795795

796796
const allowedUpsert = this.mergeRelations(this.allowedUpsert, params.mergeAllowUpsert);
@@ -881,7 +881,7 @@ class Service extends AdapterService {
881881
* @param id
882882
* @param params
883883
*/
884-
_remove (id, params) {
884+
_remove (id, params = {}) {
885885
params.query = Object.assign({}, params.query);
886886

887887
// NOTE (EK): First fetch the record so that we can return

0 commit comments

Comments
 (0)