@tachybase/database 1.3.10 → 1.3.11

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.
@@ -164,8 +164,17 @@ const _OptionsParser = class _OptionsParser {
164
164
  sortField.push(direction);
165
165
  if (this.database.isMySQLCompatibleDialect()) {
166
166
  const fieldName = sortField[0];
167
- if (this.model.fieldRawAttributesMap[fieldName]) {
168
- orderParams.push([import_sequelize.Sequelize.fn("ISNULL", import_sequelize.Sequelize.col(`${this.model.name}.${sortField[0]}`))]);
167
+ if (typeof fieldName === "string") {
168
+ if (this.model.rawAttributes[fieldName]) {
169
+ orderParams.push([
170
+ import_sequelize.Sequelize.fn("ISNULL", import_sequelize.Sequelize.col(`${this.model.name}.${this.model.rawAttributes[fieldName].field}`)),
171
+ "ASC"
172
+ ]);
173
+ }
174
+ } else {
175
+ const secondField = sortField[1];
176
+ const secondRawField = fieldName.model.rawAttributes[secondField].field || secondField;
177
+ orderParams.push([import_sequelize.Sequelize.fn("ISNULL", import_sequelize.Sequelize.col(`${fieldName.as}.${secondRawField}`)), "ASC"]);
169
178
  }
170
179
  }
171
180
  orderParams.push(sortField);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/database",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./lib/index.js",
@@ -26,8 +26,8 @@
26
26
  "semver": "7.7.2",
27
27
  "sequelize": "^6.37.5",
28
28
  "umzug": "^3.8.2",
29
- "@tachybase/logger": "1.3.10",
30
- "@tachybase/utils": "1.3.10"
29
+ "@tachybase/logger": "1.3.11",
30
+ "@tachybase/utils": "1.3.11"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/flat": "^5.0.5",