在判断relationAuth时原来有错误
This commit is contained in:
parent
eeb2e296a6
commit
6dc6f7fdce
|
|
@ -183,23 +183,24 @@ var RelationAuth = /** @class */ (function () {
|
|||
var restPaths_1 = restPath.split('.');
|
||||
var makeFilterIter_1 = function (entity2, idx, filter2) {
|
||||
var _a, _b;
|
||||
if (idx === restPaths_1.length - 1) {
|
||||
if (path[3]) {
|
||||
return {
|
||||
relativePath: relativePath_1,
|
||||
path: path,
|
||||
filter: {
|
||||
entity: entity2,
|
||||
entityId: filter2.id,
|
||||
},
|
||||
};
|
||||
}
|
||||
// 这里如果不是relation关系,则最后一项是指向user的外键名,否则最后一项就是最后一层的对象,有区别
|
||||
if (idx === restPaths_1.length - 1 && !path[3]) {
|
||||
return {
|
||||
relativePath: relativePath_1,
|
||||
path: path,
|
||||
filter: tslib_1.__assign((_a = {}, _a["".concat(restPaths_1[idx], "Id")] = userId, _a), filter2),
|
||||
};
|
||||
}
|
||||
else if (idx === restPaths_1.length && path[3]) {
|
||||
return {
|
||||
relativePath: relativePath_1,
|
||||
path: path,
|
||||
filter: {
|
||||
entity: entity2,
|
||||
entityId: filter2.id,
|
||||
},
|
||||
};
|
||||
}
|
||||
var attr = restPaths_1[idx];
|
||||
var rel = (0, relation_1.judgeRelation)(_this.schema, entity2, attr);
|
||||
if (rel === 2) {
|
||||
|
|
|
|||
|
|
@ -245,17 +245,8 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict>{
|
|||
path: AuthCascadePath<ED>;
|
||||
filter: ED[keyof ED]['Selection']['filter'];
|
||||
} => {
|
||||
if (idx === restPaths.length - 1) {
|
||||
if (path[3]) {
|
||||
return {
|
||||
relativePath,
|
||||
path,
|
||||
filter: {
|
||||
entity: entity2,
|
||||
entityId: filter2!.id,
|
||||
},
|
||||
};
|
||||
}
|
||||
// 这里如果不是relation关系,则最后一项是指向user的外键名,否则最后一项就是最后一层的对象,有区别
|
||||
if (idx === restPaths.length - 1 && !path[3]) {
|
||||
return {
|
||||
relativePath,
|
||||
path,
|
||||
|
|
@ -265,6 +256,16 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict>{
|
|||
},
|
||||
};
|
||||
}
|
||||
else if (idx === restPaths.length && path[3]) {
|
||||
return {
|
||||
relativePath,
|
||||
path,
|
||||
filter: {
|
||||
entity: entity2,
|
||||
entityId: filter2!.id,
|
||||
},
|
||||
};
|
||||
}
|
||||
const attr = restPaths[idx];
|
||||
const rel = judgeRelation(this.schema, entity2, attr);
|
||||
if (rel === 2) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue