vona-module-a-orm 5.0.82 → 5.0.83
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/dist/index.js +8 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isNil, catchError, safeBoolean, isClass, ensureArray, hashkey } from '@
|
|
|
7
7
|
import knex from 'knex';
|
|
8
8
|
import { BeanMutateBase } from 'vona-module-a-beanmutate';
|
|
9
9
|
import { swapDeps } from '@cabloy/deps';
|
|
10
|
-
import { prepareClassType, getTargetDecoratorRules, getTargetDecoratorRuleColumnsMap, Api, v, OrderMaxBase, OrderCoreBase, getSchemaDynamic, SymbolSchemaDynamicRefId, addSchemaDynamic, mergeFieldsOpenapiMetadata } from 'vona-module-a-
|
|
10
|
+
import { prepareClassType, getTargetDecoratorRules, getTargetDecoratorRuleColumnsMap, Api, v, OrderMaxBase, OrderCoreBase, getSchemaDynamic, SymbolSchemaDynamicRefId, addSchemaDynamic, mergeFieldsOpenapiMetadata } from 'vona-module-a-openapiutils';
|
|
11
11
|
import { ZodMetadata } from '@cabloy/zod-openapi';
|
|
12
12
|
import z from 'zod';
|
|
13
13
|
import { parseFirstWord, toLowerCaseFirstChar } from '@cabloy/word-utils';
|
|
@@ -1227,13 +1227,13 @@ function _initializerDefineProperty(e, i, r, l) {
|
|
|
1227
1227
|
});
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
var _dec$h, _dec2$h, _dec3$6, _dec4$4, _dec5$1, _dec6$1,
|
|
1230
|
+
var _dec$h, _dec2$h, _dec3$6, _dec4$4, _dec5$1, _dec6$1, _class$h, _descriptor$4, _descriptor2$2, _descriptor3$1;
|
|
1231
1231
|
const app$1 = useApp();
|
|
1232
1232
|
const ormConfig$1 = app$1.util.getModuleConfigRaw('a-orm');
|
|
1233
1233
|
const ordersDefault = ormConfig$1?.rest?.query?.orders?.default ?? 'createdAt,desc';
|
|
1234
1234
|
let DtoQueryBase = (_dec$h = Api.field(v.optional(), v.array(String, {
|
|
1235
1235
|
separator: ','
|
|
1236
|
-
})), _dec2$h = Reflect.metadata("design:type", Array), _dec3$6 = Api.field(v.optional(), z.looseObject({})), _dec4$4 = Reflect.metadata("design:type", Object), _dec5$1 = Api.field(v.default(ordersDefault), v.optional(), z.union([z.string(), z.array(z.array(z.string()))])), _dec6$1 =
|
|
1236
|
+
})), _dec2$h = Reflect.metadata("design:type", Array), _dec3$6 = Api.field(v.optional(), z.looseObject({})), _dec4$4 = Reflect.metadata("design:type", Object), _dec5$1 = Api.field(v.default(ordersDefault), v.optional(), z.union([z.string(), z.array(z.array(z.string()))])), _dec6$1 = Reflect.metadata("design:type", Object), _class$h = class DtoQueryBase {
|
|
1237
1237
|
constructor() {
|
|
1238
1238
|
_initializerDefineProperty(this, "columns", _descriptor$4, this);
|
|
1239
1239
|
_initializerDefineProperty(this, "where", _descriptor2$2, this);
|
|
@@ -1249,7 +1249,7 @@ let DtoQueryBase = (_dec$h = Api.field(v.optional(), v.array(String, {
|
|
|
1249
1249
|
enumerable: true,
|
|
1250
1250
|
writable: true,
|
|
1251
1251
|
initializer: null
|
|
1252
|
-
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$h.prototype, "orders", [_dec5$1, _dec6$1
|
|
1252
|
+
}), _descriptor3$1 = _applyDecoratedDescriptor(_class$h.prototype, "orders", [_dec5$1, _dec6$1], {
|
|
1253
1253
|
configurable: true,
|
|
1254
1254
|
enumerable: true,
|
|
1255
1255
|
writable: true,
|
|
@@ -1778,6 +1778,7 @@ class BeanModelKnex extends BeanModelUtils {
|
|
|
1778
1778
|
}
|
|
1779
1779
|
async queryOne(sql, bindings) {
|
|
1780
1780
|
const res = await this.query(sql, bindings);
|
|
1781
|
+
if (!res[0]) return undefined;
|
|
1781
1782
|
return res[0];
|
|
1782
1783
|
}
|
|
1783
1784
|
}
|
|
@@ -3049,9 +3050,8 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3049
3050
|
}
|
|
3050
3051
|
async selectAndCount(params, options, modelJoins) {
|
|
3051
3052
|
// pageNo/pageSize
|
|
3052
|
-
const pageSize = params?.limit;
|
|
3053
|
-
|
|
3054
|
-
const pageNo = Math.floor(params.offset / pageSize) + 1;
|
|
3053
|
+
const pageSize = params?.limit ?? this.scopeOrm.config.rest.query.pageSize.default;
|
|
3054
|
+
const pageNo = Math.floor((params?.offset ?? 0) / pageSize) + 1;
|
|
3055
3055
|
// count
|
|
3056
3056
|
const paramsCount = Object.assign({}, params, {
|
|
3057
3057
|
columns: undefined,
|
|
@@ -3338,8 +3338,7 @@ class BeanModelCache extends BeanModelCrud {
|
|
|
3338
3338
|
},
|
|
3339
3339
|
db: this.db
|
|
3340
3340
|
});
|
|
3341
|
-
if (!item) return
|
|
3342
|
-
if (!this._checkIfEntityValidByDeleted(item, options)) return undefined;
|
|
3341
|
+
if (!item || !this._checkIfEntityValidByDeleted(item, options)) return null;
|
|
3343
3342
|
return item;
|
|
3344
3343
|
}
|
|
3345
3344
|
__filterMGetColumns(items, columns) {
|