@konplit-services/common 1.0.25 → 1.0.26
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.
|
@@ -31,7 +31,7 @@ export interface FilterOptions {
|
|
|
31
31
|
accountId?: string;
|
|
32
32
|
[key: string]: any;
|
|
33
33
|
}
|
|
34
|
-
export declare const generateQueryObject: (filters: FilterOptions, searchesFieldNames?: string[], select?: string | Record<string, any
|
|
34
|
+
export declare const generateQueryObject: (filters: FilterOptions, searchesFieldNames?: string[], select?: string | Record<string, any>, populate?: (string | PopulateOptions)[]) => {
|
|
35
35
|
page: number;
|
|
36
36
|
limit: number;
|
|
37
37
|
query: any;
|
|
@@ -39,4 +39,5 @@ export declare const generateQueryObject: (filters: FilterOptions, searchesField
|
|
|
39
39
|
[key: string]: "asc" | "desc";
|
|
40
40
|
};
|
|
41
41
|
select: string | Record<string, any>;
|
|
42
|
+
populate: (string | PopulateOptions)[];
|
|
42
43
|
};
|
|
@@ -53,7 +53,7 @@ function paginate(model, options = {}) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
exports.paginate = paginate;
|
|
56
|
-
const generateQueryObject = (filters, searchesFieldNames = [], select = "") => {
|
|
56
|
+
const generateQueryObject = (filters, searchesFieldNames = [], select = "", populate = []) => {
|
|
57
57
|
const { status, limit, page, sort_by = "createdAt", order = "desc", merchantId, accountId, } = filters;
|
|
58
58
|
const excludes = [
|
|
59
59
|
"status",
|
|
@@ -117,6 +117,7 @@ const generateQueryObject = (filters, searchesFieldNames = [], select = "") => {
|
|
|
117
117
|
query: query,
|
|
118
118
|
sort: sort,
|
|
119
119
|
select: select,
|
|
120
|
+
populate,
|
|
120
121
|
};
|
|
121
122
|
};
|
|
122
123
|
exports.generateQueryObject = generateQueryObject;
|