Skip to content

Commit a72f635

Browse files
Update oauth2-core.module.ts
Adds custom `entities` option in the module methods `forRoot` and `forRootAsync`
1 parent 13a2d34 commit a72f635

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/app/oauth2-core.module.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,17 @@ export class Oauth2CoreModule implements OnModuleInit {
8787
},
8888
inject: [OAUTH2_SERVER_OPTIONS],
8989
};
90+
91+
const typeOrmEntities = options.entities || [
92+
ClientEntity,
93+
AccessTokenEntity,
94+
];
9095

9196
return {
9297
module: Oauth2CoreModule,
9398
imports: [
9499
CqrsModule,
95-
TypeOrmModule.forFeature([
96-
ClientEntity,
97-
AccessTokenEntity,
98-
]),
100+
TypeOrmModule.forFeature(typeOrmEntities),
99101
],
100102
controllers: [
101103
Oauth2Controller
@@ -142,15 +144,17 @@ export class Oauth2CoreModule implements OnModuleInit {
142144
inject: [OAUTH2_SERVER_OPTIONS],
143145
};
144146

147+
const typeOrmEntities = options.entities || [
148+
ClientEntity,
149+
AccessTokenEntity,
150+
];
151+
145152
return {
146153
module: Oauth2CoreModule,
147154
imports: [
148155
...(options.imports || []),
149156
CqrsModule,
150-
TypeOrmModule.forFeature([
151-
ClientEntity,
152-
AccessTokenEntity,
153-
]),
157+
TypeOrmModule.forFeature(typeOrmEntities),
154158
],
155159
providers: [
156160
...providers,

0 commit comments

Comments
 (0)