File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,13 @@ export function createTypeOrmProviders(
10
10
return ( entities || [ ] ) . map ( ( entity ) => ( {
11
11
provide : getRepositoryToken ( entity , dataSource ) ,
12
12
useFactory : ( dataSource : DataSource ) => {
13
- return dataSource . options . type === 'mongodb'
14
- ? dataSource . getMongoRepository ( entity )
15
- : dataSource . getRepository ( entity ) ;
13
+ const enitityMetadata = dataSource . entityMetadatas . find ( ( meta ) => meta . target === entity )
14
+ const isTreeEntity = typeof enitityMetadata ?. treeType !== 'undefined'
15
+ return isTreeEntity
16
+ ? dataSource . getTreeRepository ( entity )
17
+ : dataSource . options . type === 'mongodb'
18
+ ? dataSource . getMongoRepository ( entity )
19
+ : dataSource . getRepository ( entity ) ;
16
20
} ,
17
21
inject : [ getDataSourceToken ( dataSource ) ] ,
18
22
/**
You can’t perform that action at this time.
0 commit comments