@tachybase/database 0.23.47 → 0.23.48
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/lib/options-parser.js +1 -16
- package/package.json +3 -3
package/lib/options-parser.js
CHANGED
|
@@ -122,26 +122,11 @@ const _OptionsParser = class _OptionsParser {
|
|
|
122
122
|
* @protected
|
|
123
123
|
*/
|
|
124
124
|
parseSort(filterParams) {
|
|
125
|
-
var _a
|
|
125
|
+
var _a;
|
|
126
126
|
let sort = ((_a = this.options) == null ? void 0 : _a.sort) || [];
|
|
127
127
|
if (typeof sort === "string") {
|
|
128
128
|
sort = sort.split(",");
|
|
129
129
|
}
|
|
130
|
-
let defaultSortField = this.model.primaryKeyAttribute;
|
|
131
|
-
if (Array.isArray(this.collection.filterTargetKey)) {
|
|
132
|
-
defaultSortField = this.collection.filterTargetKey;
|
|
133
|
-
}
|
|
134
|
-
if (!defaultSortField && this.collection.filterTargetKey && !Array.isArray(this.collection.filterTargetKey)) {
|
|
135
|
-
defaultSortField = this.collection.filterTargetKey;
|
|
136
|
-
}
|
|
137
|
-
if (defaultSortField && !((_b = this.options) == null ? void 0 : _b.group)) {
|
|
138
|
-
defaultSortField = import_lodash.default.castArray(defaultSortField);
|
|
139
|
-
for (const key of defaultSortField) {
|
|
140
|
-
if (!sort.includes(key)) {
|
|
141
|
-
sort.push(key);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
130
|
const orderParams = [];
|
|
146
131
|
for (const sortKey of sort) {
|
|
147
132
|
let direction = sortKey.startsWith("-") ? "DESC" : "ASC";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/database",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.48",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"semver": "^7.6.3",
|
|
25
25
|
"sequelize": "^6.37.5",
|
|
26
26
|
"umzug": "^3.8.2",
|
|
27
|
-
"@tachybase/logger": "0.23.
|
|
28
|
-
"@tachybase/utils": "0.23.
|
|
27
|
+
"@tachybase/logger": "0.23.48",
|
|
28
|
+
"@tachybase/utils": "0.23.48"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/flat": "^5.0.5",
|