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(
1010 return ( entities || [ ] ) . map ( ( entity ) => ( {
1111 provide : getRepositoryToken ( entity , dataSource ) ,
1212 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 ) ;
1620 } ,
1721 inject : [ getDataSourceToken ( dataSource ) ] ,
1822 /**
You can’t perform that action at this time.
0 commit comments