Skip to content

Commit d164cc1

Browse files
committed
Add DI and fake email sender
1 parent 8c01052 commit d164cc1

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { EmailSender } from '../domain/EmailSender';
2+
import { Email } from '../domain/Email';
3+
4+
export default class FakeEmailSender implements EmailSender {
5+
async send(email: Email): Promise<void> {
6+
// do nothing
7+
}
8+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
services:
2+
Mooc.notifications.EmailSender:
3+
class: ../../../../../Contexts/Mooc/Notifications/infrastructure/FakeEmailSender
4+
arguments: []
5+
6+
Mooc.notifications.SendWelcomeUserEmail:
7+
class: ../../../../../Contexts/Mooc/Notifications/application/SendWelcomeUserEmail/SendWelcomeUserEmail
8+
arguments: ["@Mooc.notifications.EmailSender"]
9+
10+
Mooc.notifications.SendWelcomeUserEmailOnUserRegistered:
11+
class: ../../../../../Contexts/Mooc/Notifications/application/SendWelcomeUserEmail/SendWelcomeUserEmailOnUserRegistered
12+
arguments: ["@Mooc.notifications.SendWelcomeUserEmail"]
13+
tags:
14+
- { name: 'domainEventSubscriber' }

src/apps/mooc_backend/config/dependency-injection/application.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ imports:
22
- { resource: ./Shared/application.yaml }
33
- { resource: ./Courses/application.yaml }
44
- { resource: ./CoursesCounter/application.yaml }
5+
- { resource: ./Notifications/application.yaml }
56
- { resource: ./apps/application.yaml }

0 commit comments

Comments
 (0)