@domain.js/main 0.7.10 → 0.7.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.
@@ -376,8 +376,11 @@ function Utils(cnf, deps) {
376
376
  findOptFilter(params, name, where, Model.name);
377
377
  });
378
378
  if (!params._showDeleted) {
379
- if (Model.rawAttributes.isDeleted)
379
+ const rawAttributes = Model.getAttributes();
380
+ if ("isDeleted" in rawAttributes)
380
381
  where.isDeleted = "no";
382
+ if ("deletedAt" in rawAttributes)
383
+ where.deletedAt = null;
381
384
  }
382
385
  // 将搜索条件添加到主条件上
383
386
  const searchOptRes = searchOpt(Model, params._searchs, params.q);
@@ -392,10 +395,15 @@ function Utils(cnf, deps) {
392
395
  _.each(filterAttrs, (name) => {
393
396
  findOptFilter(params, `${x.as}.${name}`, includeWhere, x.as, name);
394
397
  });
398
+ const rawAttributes = x.model.getAttributes();
395
399
  if (!params._showDeleted) {
396
- if (x.model.rawAttributes.isDeleted) {
397
- if (x.model.rawAttributes.isDeleted)
398
- includeWhere[sequelize_1.Op.or] = [{ isDeleted: "no" }];
400
+ if ("isDeleted" in rawAttributes) {
401
+ includeWhere[sequelize_1.Op.or] = [{ isDeleted: "no" }];
402
+ if (x.required === false)
403
+ includeWhere[sequelize_1.Op.or].push({ id: null });
404
+ }
405
+ if ("deletedAt" in rawAttributes) {
406
+ includeWhere[sequelize_1.Op.or] = [{ deletedAt: null }];
399
407
  if (x.required === false)
400
408
  includeWhere[sequelize_1.Op.or].push({ id: null });
401
409
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domain.js/main",
3
- "version": "0.7.10",
3
+ "version": "0.7.11",
4
4
  "description": "DDD framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {