Skip to content

Commit 2228f9a

Browse files
committed
Fix
1 parent e403502 commit 2228f9a

File tree

4 files changed

+206
-177
lines changed

4 files changed

+206
-177
lines changed

lib/queryBuilder/queryBuilder.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict';
2+
13
const validator = require('../validator');
24

35
const validateOps = () => {
@@ -120,19 +122,22 @@ const responseConfigs = (location) => {
120122
const isToBeForwarded = () => {operations.setMode(responseObject, 'forward'); return responseConfigsObj;};
121123
const sendErrorCode = (errorCode) => {operations.setErrorCode(responseObject, errorCode); return responseConfigsObj;};
122124
const debug = (isDebug) => {operations.setDebug(responseObject, !!isDebug); return responseConfigsObj;};
123-
const param = (par) => setParam(par, location, responseObject);
125+
const addParams = (paramList) => addParamList(paramList, location, responseObject);
124126

125127
const responseConfigsObj = {
126128
isToBeRejected,
127129
isToBeForwarded,
128130
sendErrorCode,
129131
debug,
130-
param,
132+
addParams,
131133
};
132134
return responseConfigsObj;
133135
};
134-
const setParam = (param, location, responseObject) => {
135-
return fieldProperties(location, responseObject).param(param);
136+
const addParamList = (paramList, location, responseObject) => {
137+
return fieldProperties(location, responseObject).addChildren(paramList);
138+
};
139+
const setParam = (param) => {
140+
return fieldProperties().param(param);
136141
};
137142
const fieldProperties = (location, responseObj) => {
138143
const validationObject = {};
@@ -143,7 +148,7 @@ const fieldProperties = (location, responseObj) => {
143148

144149
const param = (par) => {validationObject.param = par; return fieldFunctions;};
145150
const isRequired = () => {operations.isRequired(validationObject); return fieldFunctions;};
146-
const done = () => validator(validationObject, responseObject);
151+
const done = () => validator(validationObject.location, validationObject.children, responseObject);
147152
const end = () => validationObject;
148153
const addChild = (child) => {operations.addChild(validationObject, child); return fieldFunctions;};
149154
const addChildren = (children) => {operations.addChildren(validationObject, children); return fieldFunctions;};
@@ -192,6 +197,7 @@ const fieldProperties = (location, responseObj) => {
192197
isMobileNumberWithMaximumLength,
193198
};
194199
return {
200+
addChildren,
195201
param,
196202
};
197203
};

0 commit comments

Comments
 (0)