刚才的改法有个问题,漏了全等的情况
This commit is contained in:
parent
93f934f0af
commit
6dde36ef83
|
|
@ -124,14 +124,14 @@ var RelationAuth = /** @class */ (function () {
|
|||
var filters = authCascadePaths.filter(function (path) {
|
||||
// 被entity的外键连接所排队的路径,这个非常重要,否则像extraFile这样的对象会有过多的查询路径
|
||||
for (var k in excludePaths) {
|
||||
if (path[1].startsWith(k) && !excludePaths[k].find(function (ele) { return path[1].startsWith("".concat(ele, ".")); })) {
|
||||
if (path[1].startsWith(k) && !excludePaths[k].find(function (ele) { return path[1].startsWith("".concat(ele, ".")) || path[1] === ele; })) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}).map(function (path) {
|
||||
// 这里anchor的relativePath按长度倒排,所以找到的第一个匹配关系应该就是最准确的
|
||||
var relatedAnchor = anchors.find(function (anchor) { return path[1].startsWith("".concat(anchor.relativePath, ".")); });
|
||||
var relatedAnchor = anchors.find(function (anchor) { return path[1].startsWith("".concat(anchor.relativePath, ".")) || path[1] === anchor.relativePath; });
|
||||
if (relatedAnchor) {
|
||||
var entity_1 = relatedAnchor.entity, relativePath_1 = relatedAnchor.relativePath, filter_2 = relatedAnchor.filter;
|
||||
var restPath = relativePath_1 === path[1] ? '' : relativePath_1 === '' ? path[1] : path[1].slice(relativePath_1.length + 1);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict>{
|
|||
(path) => {
|
||||
// 被entity的外键连接所排队的路径,这个非常重要,否则像extraFile这样的对象会有过多的查询路径
|
||||
for (const k in excludePaths) {
|
||||
if (path[1].startsWith(k) && !excludePaths[k].find(ele => path[1].startsWith(`${ele}.`))) {
|
||||
if (path[1].startsWith(k) && !excludePaths[k].find(ele => path[1].startsWith(`${ele}.`) || path[1] === ele)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ export class RelationAuth<ED extends EntityDict & BaseEntityDict>{
|
|||
(path) => {
|
||||
// 这里anchor的relativePath按长度倒排,所以找到的第一个匹配关系应该就是最准确的
|
||||
const relatedAnchor = anchors.find(
|
||||
(anchor) => path[1].startsWith(`${anchor.relativePath}.`)
|
||||
(anchor) => path[1].startsWith(`${anchor.relativePath}.`) || path[1] === anchor.relativePath
|
||||
);
|
||||
if (relatedAnchor) {
|
||||
const { entity, relativePath, filter } = relatedAnchor;
|
||||
|
|
|
|||
Loading…
Reference in New Issue