File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
src/components/notifications Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1
- import { DiscoveryService } from '@golevelup/nestjs-discovery' ;
2
1
import {
3
2
forwardRef ,
4
3
Inject ,
@@ -13,6 +12,7 @@ import {
13
12
ServerException ,
14
13
type UnsecuredDto ,
15
14
} from '~/common' ;
15
+ import { MetadataDiscovery } from '~/core/discovery' ;
16
16
import {
17
17
type MarkNotificationReadArgs ,
18
18
type Notification ,
@@ -62,7 +62,7 @@ export class NotificationServiceImpl
62
62
> ;
63
63
readonly ready = new ( ( Event as any ) . default as typeof Event ) ( ) ;
64
64
65
- constructor ( private readonly discovery : DiscoveryService ) {
65
+ constructor ( private readonly discovery : MetadataDiscovery ) {
66
66
super ( ) ;
67
67
}
68
68
@@ -88,11 +88,8 @@ export class NotificationServiceImpl
88
88
}
89
89
90
90
async onModuleInit ( ) {
91
- const discovered = await this . discovery . providersWithMetaAtKey <
92
- ResourceShape < Notification >
93
- > ( NotificationStrategy . KEY ) ;
94
- this . strategyMap = mapEntries ( discovered , ( { meta, discoveredClass } ) => {
95
- const { instance } = discoveredClass ;
91
+ const discovered = this . discovery . discover ( NotificationStrategy ) . classes ( ) ;
92
+ this . strategyMap = mapEntries ( discovered , ( { meta, instance } ) => {
96
93
if ( ! ( instance instanceof INotificationStrategy ) ) {
97
94
throw new ServerException (
98
95
`Strategy for ${ meta . name } does not implement INotificationStrategy` ,
You can’t perform that action at this time.
0 commit comments