drapcode-utility 2.3.2 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -172,8 +172,10 @@ const createFilterQuery = (query, externalParams, constants, timezone, authDetai
172
172
  const filterQuery = { $or0: [] };
173
173
  const finalConditions = [];
174
174
  conditions.forEach((queryObj, index) => {
175
+ console.log("queryObj :>> ", queryObj);
175
176
  const { query, requiredExternal, conjunctionType } = queryObj;
176
177
  let mongoQuery = conditionToQuery(query, requiredExternal, externalParams, constants, timezone, authDetail);
178
+ console.log("mongoQuery :>> ", mongoQuery);
177
179
  if (mongoQuery) {
178
180
  finalConditions.push({ conjunctionType, query: mongoQuery });
179
181
  queryConjunctions.push(conjunctionType || "OR");
@@ -225,6 +227,7 @@ const prepareFinalQueryString = (conditions) => {
225
227
  };
226
228
  const conditionToQuery = (query, requiredExternal, externalParams, constants, timezone, authDetail) => {
227
229
  const { key, field, value, fieldType } = query;
230
+ console.log("query :>> ", query);
228
231
  if ([drapcode_constant_1.NOT_EQUAL, ...isEqualOrIgnore].includes(key) &&
229
232
  typeof value === "string" &&
230
233
  drapcode_constant_1.DateRangeConstant.some((cnst) => value.includes(cnst))) {
@@ -233,6 +236,8 @@ const conditionToQuery = (query, requiredExternal, externalParams, constants, ti
233
236
  }
234
237
  console.log("No date range constants");
235
238
  let fieldValue = changeExternalParams(query, requiredExternal, externalParams, constants, timezone, authDetail);
239
+ console.log("fieldValue :>> ", fieldValue);
240
+ console.log("type of fieldValue :>> ", typeof fieldValue);
236
241
  if (["undefined", "null", null, undefined, ""].includes(fieldValue)) {
237
242
  //Assign some random value if fieldValue is missing from old records
238
243
  fieldValue = noFieldString;
@@ -367,8 +372,12 @@ const conditionToQuery = (query, requiredExternal, externalParams, constants, ti
367
372
  }
368
373
  //Since we already check equal & equal ignore for boolean, number, date, createdBy
369
374
  //Now if it still equal & equal ignore, but no field type match then
375
+ console.log("Equal & Non Equal has been checked for boolean, number, date etc");
376
+ console.log("Now it will be by default string, if issue with comparison please verify");
370
377
  if (isEqualOrIgnore.includes(key)) {
371
- return { [field]: fieldValue };
378
+ return {
379
+ [field]: typeof fieldValue === "number" ? `${fieldValue}` : fieldValue,
380
+ };
372
381
  }
373
382
  }
374
383
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drapcode-utility",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,9 +42,9 @@
42
42
  "axios": "^1.1.2",
43
43
  "date-fns": "^4.1.0",
44
44
  "dompurify": "^3.1.7",
45
- "drapcode-constant": "^1.9.3",
45
+ "drapcode-constant": "^1.9.4",
46
46
  "drapcode-logger": "^1.3.5",
47
- "drapcode-redis": "^1.3.11",
47
+ "drapcode-redis": "^1.3.12",
48
48
  "exiftool-vendored": "^28.2.1",
49
49
  "express": "^4.17.1",
50
50
  "gm": "^1.25.0",