c2-mongoose 2.1.447 → 2.1.448

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.
@@ -56,7 +56,8 @@ var BuildAndQueriesFlowItem = /** @class */ (function () {
56
56
  'posSteps',
57
57
  'metadata',
58
58
  'docs.',
59
- 'docsOrderSense'
59
+ 'docsOrderSense',
60
+ 'docsOrderBy'
60
61
  ].includes(key)) {
61
62
  return;
62
63
  }
@@ -74,20 +74,20 @@ var GroupV3FlowItem = /** @class */ (function () {
74
74
  projectClause.$project["".concat(sumField, "Total")] = "$".concat(tempFieldName);
75
75
  }
76
76
  groupsClauses.push(projectClause);
77
- if (detailed && (filters === null || filters === void 0 ? void 0 : filters.orderBy)) {
78
- var ordenation = (_b = filters.orderBy) === null || _b === void 0 ? void 0 : _b.split(',').map(function (field) { return field === null || field === void 0 ? void 0 : field.trim(); });
77
+ if (detailed && (filters === null || filters === void 0 ? void 0 : filters.docsOrderBy)) {
78
+ var ordenation = (_b = filters.docsOrderBy) === null || _b === void 0 ? void 0 : _b.split(',').map(function (field) { return field === null || field === void 0 ? void 0 : field.trim(); });
79
79
  var sortByFields_1 = {};
80
80
  ordenation === null || ordenation === void 0 ? void 0 : ordenation.filter(function (o) { return o.startsWith('docs.'); }).forEach(function (order) {
81
81
  sortByFields_1[order.replace(/^docs\./, '')] = filters.docsOrderSense === 'desc' ? -1 : 1;
82
82
  });
83
- // const orderBy = Array.isArray(filters.orderBy) ? filters.orderBy : [filters.orderBy]
84
- // const docOrderBy = orderBy.filter((o: string) => typeof o === 'string' && o.startsWith('docs.'))
83
+ // const groupOrderBy = Array.isArray(filters.groupOrderBy) ? filters.groupOrderBy : [filters.groupOrderBy]
84
+ // const docgroupOrderBy = groupOrderBy.filter((o: string) => typeof o === 'string' && o.startsWith('docs.'))
85
85
  // const sortByFields: Record<string, 1 | -1> = {}
86
- // for (const o of docOrderBy) {
86
+ // for (const o of docgroupOrderBy) {
87
87
  // sortByFields[o.replace(/^doc\./, '')] = filters.orderSense === 'desc' ? -1 : 1
88
88
  // }
89
- var remainingOrderBy = ordenation.filter(function (o) { return typeof o !== 'string' || !o.startsWith('docs.'); });
90
- filters.orderBy = remainingOrderBy.length ? remainingOrderBy.join(',') : undefined;
89
+ // const remaininggroupOrderBy = ordenation.filter((o: string) => typeof o !== 'string' || !o.startsWith('docs.'))
90
+ // filters.groupOrderBy = remaininggroupOrderBy.length ? remaininggroupOrderBy.join(',') : undefined
91
91
  if (Object.keys(sortByFields_1).length > 0) {
92
92
  groupsClauses.push({
93
93
  $set: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.447",
3
+ "version": "2.1.448",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,7 +37,8 @@ class BuildAndQueriesFlowItem {
37
37
  'posSteps',
38
38
  'metadata',
39
39
  'docs.',
40
- 'docsOrderSense'
40
+ 'docsOrderSense',
41
+ 'docsOrderBy'
41
42
  ].includes(key)) {
42
43
  return
43
44
  }
@@ -79,10 +79,10 @@ class GroupV3FlowItem {
79
79
 
80
80
  groupsClauses.push(projectClause)
81
81
 
82
- if (detailed && filters?.orderBy) {
82
+ if (detailed && filters?.docsOrderBy) {
83
83
 
84
84
 
85
- const ordenation = filters.orderBy?.split(',').map((field: string) => field?.trim())
85
+ const ordenation = filters.docsOrderBy?.split(',').map((field: string) => field?.trim())
86
86
 
87
87
  const sortByFields: Record<string, 1 | -1> = {}
88
88
  ordenation?.filter((o: string) => o.startsWith('docs.')).forEach((order: string) => {
@@ -90,15 +90,15 @@ class GroupV3FlowItem {
90
90
  })
91
91
 
92
92
 
93
- // const orderBy = Array.isArray(filters.orderBy) ? filters.orderBy : [filters.orderBy]
94
- // const docOrderBy = orderBy.filter((o: string) => typeof o === 'string' && o.startsWith('docs.'))
93
+ // const groupOrderBy = Array.isArray(filters.groupOrderBy) ? filters.groupOrderBy : [filters.groupOrderBy]
94
+ // const docgroupOrderBy = groupOrderBy.filter((o: string) => typeof o === 'string' && o.startsWith('docs.'))
95
95
  // const sortByFields: Record<string, 1 | -1> = {}
96
- // for (const o of docOrderBy) {
96
+ // for (const o of docgroupOrderBy) {
97
97
  // sortByFields[o.replace(/^doc\./, '')] = filters.orderSense === 'desc' ? -1 : 1
98
98
  // }
99
99
 
100
- const remainingOrderBy = ordenation.filter((o: string) => typeof o !== 'string' || !o.startsWith('docs.'))
101
- filters.orderBy = remainingOrderBy.length ? remainingOrderBy.join(',') : undefined
100
+ // const remaininggroupOrderBy = ordenation.filter((o: string) => typeof o !== 'string' || !o.startsWith('docs.'))
101
+ // filters.groupOrderBy = remaininggroupOrderBy.length ? remaininggroupOrderBy.join(',') : undefined
102
102
 
103
103
  if (Object.keys(sortByFields).length > 0) {
104
104
  groupsClauses.push({