前台缓存中允许外键空指针
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) {
|
RelationAuth.prototype.filterActionAuths = function (entity, filter, actionAuths, context, actions) {
|
||||||
return actionAuths.map(function (ele) {
|
return actionAuths.map(function (ele) {
|
||||||
var paths = ele.paths, relation = ele.relation, relationId = ele.relationId;
|
var paths = ele.paths, relation = ele.relation, relationId = ele.relationId;
|
||||||
if (relationId) {
|
// 在cache中,可能出现relation外键指向的对象为null的情况,要容错
|
||||||
(0, assert_1.default)(relation);
|
if (relation) {
|
||||||
var userRelations = relation.userRelation$relation;
|
var userRelations = relation.userRelation$relation;
|
||||||
if (userRelations.length > 0) {
|
if (userRelations.length > 0) {
|
||||||
var entityIds = (0, lodash_1.uniq)(userRelations.map(function (ele) { return ele.entityId; }));
|
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(
|
return actionAuths.map(
|
||||||
(ele) => {
|
(ele) => {
|
||||||
const { paths, relation, relationId } = ele;
|
const { paths, relation, relationId } = ele;
|
||||||
if (relationId) {
|
|
||||||
assert(relation);
|
// 在cache中,可能出现relation外键指向的对象为null的情况,要容错
|
||||||
|
if (relation) {
|
||||||
const { userRelation$relation: userRelations } = relation;
|
const { userRelation$relation: userRelations } = relation;
|
||||||
if (userRelations!.length > 0) {
|
if (userRelations!.length > 0) {
|
||||||
const entityIds = uniq(userRelations!.map(ele => ele.entityId));
|
const entityIds = uniq(userRelations!.map(ele => ele.entityId));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue