Skip to content

Commit

Permalink
fix(): address dynamic module serialisation issue #958
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Aug 3, 2021
1 parent 1658432 commit fed70fb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/typeorm.providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AbstractRepository,
Connection,
ConnectionOptions,
getMetadataArgsStorage,
Repository,
} from 'typeorm';
import { getConnectionToken, getRepositoryToken } from './common/typeorm.utils';
Expand All @@ -28,5 +29,13 @@ export function createTypeOrmProviders(
: connection.getRepository(entity);
},
inject: [getConnectionToken(connection)],
/**
* Extra property to workaround dynamic modules serialisation issue
* that occurs when "TypeOrm#forFeature()" method is called with the same number
* of arguments and all entities share the same class names.
*/
targetEntitySchema: getMetadataArgsStorage().tables.find(
(item) => item.target === entity,
),
}));
}

0 comments on commit fed70fb

Please sign in to comment.