fix: eager load belongs to many association (#1906)

This commit is contained in:
ChengLei Shao 2023-05-22 16:09:37 +08:00 committed by GitHub
parent e27cff15c9
commit 5288cbb1cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -242,7 +242,7 @@ export class EagerLoadingTree {
for (const instance of node.instances) { for (const instance of node.instances) {
const parentInstance = node.parent.instances.find( const parentInstance = node.parent.instances.find(
(parentInstance) => parentInstance.get(sourceKey) == instance.get(oneFromTarget.as).get(foreignKey), (parentInstance) => parentInstance.get(sourceKey) == instance[oneFromTarget.as].get(foreignKey),
); );
if (parentInstance) { if (parentInstance) {

View File

@ -24,6 +24,12 @@ describe('role check action', () => {
}, },
}); });
await role.createMenuUiSchema({
values: {
name: 'test',
},
});
const user = await db.getRepository('users').create({ const user = await db.getRepository('users').create({
values: { values: {
roles: ['test'], roles: ['test'],