my-typescript-library-rahul52us 2.5.6 → 2.5.7
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.
package/package.json
CHANGED
|
@@ -191,12 +191,16 @@ export async function getAllDocument(
|
|
|
191
191
|
) {
|
|
192
192
|
try {
|
|
193
193
|
let matchQuery: any = {};
|
|
194
|
-
if (searchField && searchValue?.trim()) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
if (Array.isArray(searchField) && searchValue?.trim()) {
|
|
195
|
+
const active = searchField.find((f: any) => f.isActive);
|
|
196
|
+
if (active && Array.isArray(active.key) && active.key.length > 0) {
|
|
197
|
+
matchQuery = {
|
|
198
|
+
$or: active.key.map((k: string) => ({
|
|
199
|
+
[`originalValues.${k}`]: { $regex: searchValue, $options: "i" },
|
|
200
|
+
})),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
}
|
|
200
204
|
|
|
201
205
|
if (startDate) {
|
|
202
206
|
matchQuery[dateFilterKey] = { $gte: new Date(startDate) };
|
|
@@ -228,11 +232,11 @@ export async function getAllDocument(
|
|
|
228
232
|
});
|
|
229
233
|
}
|
|
230
234
|
|
|
231
|
-
Object.entries(matchConditions).forEach(([field, value]) => {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
235
|
+
// Object.entries(matchConditions).forEach(([field, value]) => {
|
|
236
|
+
// if (Array.isArray(value)) {
|
|
237
|
+
// matchConditions[field] = { $in: value };
|
|
238
|
+
// }
|
|
239
|
+
// });
|
|
236
240
|
|
|
237
241
|
let pipeline: any = [];
|
|
238
242
|
|
|
@@ -2008,7 +2012,7 @@ export async function updateDocument(id: string, data: any, workflow?: any) {
|
|
|
2008
2012
|
|
|
2009
2013
|
// Fetch file content
|
|
2010
2014
|
const fileStream = bucket.openDownloadStream(updatedDocument.file);
|
|
2011
|
-
const fileDataChunks:
|
|
2015
|
+
const fileDataChunks: any[] = [];
|
|
2012
2016
|
|
|
2013
2017
|
await new Promise((resolve, reject) => {
|
|
2014
2018
|
fileStream.on("data", (chunk) => fileDataChunks.push(chunk));
|
|
@@ -725,10 +725,11 @@ export async function getAllDocumentFunction(req: any) {
|
|
|
725
725
|
);
|
|
726
726
|
let files: any = [];
|
|
727
727
|
if (statusCode === "success") {
|
|
728
|
-
if (Array.isArray(data.values.table)) {
|
|
729
|
-
let filterTable = data.values.table.filter(
|
|
728
|
+
if (Array.isArray(data.values.values?.table)) {
|
|
729
|
+
let filterTable = data.values.values?.table.filter(
|
|
730
730
|
(item: any) => item.isActive === true
|
|
731
731
|
);
|
|
732
|
+
|
|
732
733
|
if (filterTable.length) {
|
|
733
734
|
files = filterTable[0].columnName
|
|
734
735
|
?.filter((dt: any) => dt.isFile)
|
|
@@ -756,7 +757,7 @@ export async function getAllDocumentFunction(req: any) {
|
|
|
756
757
|
manual,
|
|
757
758
|
dateFrom,
|
|
758
759
|
dateTo,
|
|
759
|
-
searchField,
|
|
760
|
+
searchField = data?.values?.searchFilter || [],
|
|
760
761
|
dateFilterKey,
|
|
761
762
|
sortByKey,
|
|
762
763
|
files
|