前台缓存中允许外键空指针
This commit is contained in:
parent
132b3b2902
commit
c42b4d49b0
|
|
@ -477,8 +477,8 @@ var RelationAuth = /** @class */ (function () {
|
|||
RelationAuth.prototype.filterActionAuths = function (entity, filter, actionAuths, context, actions) {
|
||||
return actionAuths.map(function (ele) {
|
||||
var paths = ele.paths, relation = ele.relation, relationId = ele.relationId;
|
||||
if (relationId) {
|
||||
(0, assert_1.default)(relation);
|
||||
// 在cache中,可能出现relation外键指向的对象为null的情况,要容错
|
||||
if (relation) {
|
||||
var userRelations = relation.userRelation$relation;
|
||||
if (userRelations.length > 0) {
|
||||
var entityIds = (0, lodash_1.uniq)(userRelations.map(function (ele) { return ele.entityId; }));
|
||||
|
|
|
|||
|
|
@ -572,8 +572,9 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict>{
|
|||
return actionAuths.map(
|
||||
(ele) => {
|
||||
const { paths, relation, relationId } = ele;
|
||||
if (relationId) {
|
||||
assert(relation);
|
||||
|
||||
// 在cache中,可能出现relation外键指向的对象为null的情况,要容错
|
||||
if (relation) {
|
||||
const { userRelation$relation: userRelations } = relation;
|
||||
if (userRelations!.length > 0) {
|
||||
const entityIds = uniq(userRelations!.map(ele => ele.entityId));
|
||||
|
|
|
|||
Loading…
Reference in New Issue