Skip to content

Commit 1a75c2f

Browse files
VaragosTraigordependabot[bot]danias
authored
Develop (#28)
* changes for the metadata refactor * Bump web-vitals from 3.3.0 to 3.3.1 in /frontend Bumps [web-vitals](https://github.com/GoogleChrome/web-vitals) from 3.3.0 to 3.3.1. - [Release notes](https://github.com/GoogleChrome/web-vitals/releases) - [Changelog](https://github.com/GoogleChrome/web-vitals/blob/main/CHANGELOG.md) - [Commits](GoogleChrome/web-vitals@v3.3.0...v3.3.1) --- updated-dependencies: - dependency-name: web-vitals dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump mongodb from 5.1.0 to 5.2.0 in /backend Bumps [mongodb](https://github.com/mongodb/node-mongodb-native) from 5.1.0 to 5.2.0. - [Release notes](https://github.com/mongodb/node-mongodb-native/releases) - [Changelog](https://github.com/mongodb/node-mongodb-native/blob/main/HISTORY.md) - [Commits](mongodb/node-mongodb-native@v5.1.0...v5.2.0) --- updated-dependencies: - dependency-name: mongodb dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump axios from 1.3.4 to 1.3.5 in /frontend Bumps [axios](https://github.com/axios/axios) from 1.3.4 to 1.3.5. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](axios/axios@v1.3.4...v1.3.5) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump jest and @types/jest in /backend Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) and [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest). These dependencies needed to be updated together. Updates `jest` from 29.3.1 to 29.5.0 - [Release notes](https://github.com/facebook/jest/releases) - [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/jest/commits/v29.5.0/packages/jest) Updates `@types/jest` from 29.2.4 to 29.5.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest) --- updated-dependencies: - dependency-name: jest dependency-type: direct:development update-type: version-update:semver-minor - dependency-name: "@types/jest" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump @nestjs/common from 9.3.12 to 9.4.0 in /backend Bumps [@nestjs/common](https://github.com/nestjs/nest) from 9.3.12 to 9.4.0. - [Release notes](https://github.com/nestjs/nest/releases) - [Commits](nestjs/nest@v9.3.12...v9.4.0) --- updated-dependencies: - dependency-name: "@nestjs/common" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump @typescript-eslint/eslint-plugin from 5.57.0 to 5.57.1 in /backend Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.57.0 to 5.57.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.57.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump @opentelemetry/sdk-node from 0.36.1 to 0.37.0 in /backend Bumps [@opentelemetry/sdk-node](https://github.com/open-telemetry/opentelemetry-js) from 0.36.1 to 0.37.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-js/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-js/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-js/commits/experimental/v0.37.0) --- updated-dependencies: - dependency-name: "@opentelemetry/sdk-node" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump typescript from 5.0.3 to 5.0.4 in /frontend Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.0.3 to 5.0.4. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](microsoft/TypeScript@v5.0.3...v5.0.4) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump @types/react from 18.0.31 to 18.0.33 in /frontend Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.0.31 to 18.0.33. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Updated protogen.sh * increased version to v0.1.1 * update domain event props * fix red test * update dependencies * update dependencies * moved dev dependencies under... devDependencies * Bump @types/react from 18.0.33 to 18.0.34 in /frontend (#21) Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.0.33 to 18.0.34. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Code generated comments updated * Bump @nestjs/platform-fastify from 9.3.12 to 9.4.0 in /backend (#26) Bumps [@nestjs/platform-fastify](https://github.com/nestjs/nest) from 9.3.12 to 9.4.0. - [Release notes](https://github.com/nestjs/nest/releases) - [Commits](nestjs/nest@v9.3.12...v9.4.0) --- updated-dependencies: - dependency-name: "@nestjs/platform-fastify" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Removed unnecessary packages * Bump ts-jest from 29.0.5 to 29.1.0 in /backend (#25) Bumps [ts-jest](https://github.com/kulshekhar/ts-jest) from 29.0.5 to 29.1.0. - [Release notes](https://github.com/kulshekhar/ts-jest/releases) - [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md) - [Commits](kulshekhar/ts-jest@v29.0.5...v29.1.0) --- updated-dependencies: - dependency-name: ts-jest dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Removed unused packages * Bumped versions * rename files based on convention * fix names and imports * organize event handler exports * fix iam module imports * extract send email struct * fix modify title command * add missing injection tokens * fix primitive mappers & tests * update development steps * remove strict checks --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Spiros Grigoratos <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vasilis Danias <[email protected]> Co-authored-by: Vasilis Danias <[email protected]>
1 parent 44c732e commit 1a75c2f

File tree

86 files changed

+352
-311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+352
-311
lines changed

backend/development-steps.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
1-
### Source code under `lib/` folder is transpiled based on the bl code we have written.
1+
## Transpile bl code
22

3-
It contains our application and domain layers. Each application handler/use-case is injected some ports which are associated with a token. This token will be used to attach the concreted adapter.
3+
Transpile your bl code giving as target option path the absolute path of your project's `src/lib`.
44

5-
### Every folder under `bitloops/` is a nestjs plugin, and can be assumed to be a npm package.
5+
Remove strict and strictNullChecks from your tsconfig if present.
66

7-
Add `config/` folder and define some initial configuration for your app. e.g. http_port, host etc. You will be adding database, apiKeys, secrets and so on there later based on your adapters.
8-
`yarn add @nestjs/config`. Create a `.development.env` file and gitignore it.
7+
## Install dependencies
98

10-
## Project structure
11-
12-
We start with 2 root modules. The `api` module, which contains all the controllers and acts as our application gateway, and the `app` module which is a modular monolith containing all our modules(with their infra, application & domain layers). We need to write the api code, and the infra code for each module(with concretions of each port used by application layers).
9+
```bash
10+
# install bitloops plugins
11+
yarn add @bitloops/bl-boilerplate-core \
12+
@bitloops/bl-boilerplate-infra-mongo \
13+
@bitloops/bl-boilerplate-infra-nest-auth-passport \
14+
@bitloops/bl-boilerplate-infra-nest-jetstream \
15+
@bitloops/bl-boilerplate-infra-postgres \
16+
@bitloops/bl-boilerplate-infra-telemetry \
17+
nats \
18+
mongodb
19+
```
1320

1421
### Api module
1522

16-
Each controller will have injected the commandBus or/and the queryBus from the bus-plugin you will be using. On `api.module.ts` we register the controllers, and as imports the buses-plugin, the auth-module plugin and nest' config module if we need it. Each controller dispatches a command/query using the appropriate bus and then handles the response matching each error to the appropriate response code.
17-
18-
- grpc
19-
`yarn add @grpc/grpc-js google-protobuf`
23+
Each controller will have injected the commandBus or/and the queryBus from the bus-plugin you will be using. On `api.module.ts` we register the controllers, import the buses-plugin, the auth-module plugin and nest's config module if needed. Each controller dispatches a command/query using the appropriate bus and then handles the response, by matching each error to the appropriate response code.
2024

2125
### App module
2226

2327
We will be registering each bl module, connecting it with its required adapters. We can place this code under `src/bounded-contexts/[bounded-context-name]/[module-name]/`.
2428

2529
Each bl module is a dynamic module, so when we import it, we need to pass the injected modules & adapters(nestjs providers) as arguments.
2630

31+
Every bl module has a `constants.ts` file, listing all the injection tokens its respective infra module will have to provide.
32+
2733
## Tracing
2834

2935
We can trace the execution of a method by using the @Traceable decorator provided by the bitloops-tracing plugin. Let's say we want to use it on the api module to trace the duration of a `addTodo` post http route. First we have to register the plugin in the `api.module.ts`. After that we just decorate the method we want.

backend/src/api/todo.grpc.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ import { CorrelationIdInterceptor } from '@bitloops/bl-boilerplate-infra-telemet
2323
import { GetTodosQuery } from '@src/lib/bounded-contexts/todo/todo/queries/get-todos.query';
2424
import { CompleteTodoCommand } from '@src/lib/bounded-contexts/todo/todo/commands/complete-todo.command';
2525
import { UncompleteTodoCommand } from '@src/lib/bounded-contexts/todo/todo/commands/uncomplete-todo.command';
26-
import { ModifyTodoTitleCommand } from '@src/lib/bounded-contexts/todo/todo/commands/modify-title-todo.command';
26+
import { ModifyTodoTitleCommand } from '@src/lib/bounded-contexts/todo/todo/commands/modify-todo-title.command';
2727
import { DeleteTodoCommand } from '@src/lib/bounded-contexts/todo/todo/commands/delete-todo.command';
2828
import { AuthEnvironmentVariables } from '@src/config/auth.configuration';
2929

3030
import { todo } from '../proto/generated/todo';
31-
import { AddTodoCommand } from '../lib/bounded-contexts/todo/todo/commands/add-todo.command';
31+
import { AddTodoCommand } from '@src/lib/bounded-contexts/todo/todo/commands/add-todo.command';
3232
import { TodoAddedPubSubIntegrationEventHandler } from './pub-sub-handlers/todo-added.integration-handler';
3333
import { TodoDeletedPubSubIntegrationEventHandler } from './pub-sub-handlers/todo-deleted.integration-handler';
3434
import { TodoCompletedPubSubIntegrationEventHandler } from './pub-sub-handlers/todo-completed.integration-handler';

backend/src/api/todo.rest.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ import {
1111
Request,
1212
} from '@nestjs/common';
1313
import { ConfigService } from '@nestjs/config';
14-
import { TodoReadModel } from '../lib/bounded-contexts/todo/todo/domain/TodoReadModel';
15-
import { AddTodoCommand } from '../lib/bounded-contexts/todo/todo/commands/add-todo.command';
1614
import { AddTodoDto } from './dto/add-todo.dto';
1715
import { CompleteTodoDto } from './dto/complete-todo.dto';
18-
import { GetTodosQuery } from '../lib/bounded-contexts/todo/todo/queries/get-todos.query';
1916

2017
import { BUSES_TOKENS } from '@bitloops/bl-boilerplate-infra-nest-jetstream';
2118
import { AuthEnvironmentVariables } from '@src/config/auth.configuration';
2219
import { JwtAuthGuard } from '@bitloops/bl-boilerplate-infra-nest-auth-passport';
2320
import { Infra } from '@bitloops/bl-boilerplate-core';
2421
import { CompleteTodoCommand } from '@src/lib/bounded-contexts/todo/todo/commands/complete-todo.command';
22+
import { TodoReadModel } from '@src/lib/bounded-contexts/todo/todo/domain/todo.read-model';
23+
import { AddTodoCommand } from '@src/lib/bounded-contexts/todo/todo/commands/add-todo.command';
24+
import { GetTodosQuery } from '@src/lib/bounded-contexts/todo/todo/queries/get-todos.query';
2525

2626
@Injectable()
2727
@Controller('todo')

backend/src/bounded-contexts/iam/iam/iam.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { Module } from '@nestjs/common';
22

3-
import { IamModule as LibIamModule } from 'src/lib/bounded-contexts/iam/authentication/iam.module';
3+
import { AuthenticationModule as LibIamModule } from '@src/lib/bounded-contexts/iam/authentication/authentication.module';
44
import { MongoModule } from '@bitloops/bl-boilerplate-infra-mongo';
55
import { PostgresModule } from '@bitloops/bl-boilerplate-infra-postgres';
6-
import { UserWriteRepoPortToken } from '@src/lib/bounded-contexts/iam/authentication/ports/UserWriteRepoPort';
76
import { PubSubCommandHandlers } from '@src/lib/bounded-contexts/iam/authentication/application/command-handlers';
87
import {
98
JetstreamModule,
109
NatsStreamingDomainEventBus,
1110
NatsStreamingIntegrationEventBus,
1211
} from '@bitloops/bl-boilerplate-infra-nest-jetstream';
13-
import { StreamingDomainEventHandlers } from '@src/lib/bounded-contexts/iam/authentication/application/event-handlers';
12+
import { StreamingDomainEventHandlers } from '@src/lib/bounded-contexts/iam/authentication/application/event-handlers/domain';
1413
import {
1514
StreamingDomainEventBusToken,
1615
StreamingIntegrationEventBusToken,
16+
UserWriteRepoPortToken,
1717
} from '@src/lib/bounded-contexts/iam/authentication/constants';
1818
import { UserWritePostgresRepository } from './repository/user-write.pg.repository';
1919

backend/src/bounded-contexts/iam/iam/repository/user-write.pg.repository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import {
88
} from '@bitloops/bl-boilerplate-core';
99
import { Injectable, Inject } from '@nestjs/common';
1010
import * as jwtwebtoken from 'jsonwebtoken';
11-
import { UserWriteRepoPort } from '@src/lib/bounded-contexts/iam/authentication/ports/UserWriteRepoPort';
12-
import { UserEntity } from '@src/lib/bounded-contexts/iam/authentication/domain/UserEntity';
11+
import { UserWriteRepoPort } from '@src/lib/bounded-contexts/iam/authentication/ports/user-write.repo-port';
12+
import { UserEntity } from '@src/lib/bounded-contexts/iam/authentication/domain/user.entity';
1313
import { constants } from '@bitloops/bl-boilerplate-infra-postgres';
14-
import { EmailVO } from '@src/lib/bounded-contexts/iam/authentication/domain/EmailVO';
14+
import { EmailVO } from '@src/lib/bounded-contexts/iam/authentication/domain/email.value-object';
1515
import { ConfigService } from '@nestjs/config';
1616
import { AuthEnvironmentVariables } from '@src/config/auth.configuration';
1717
import { StreamingDomainEventBusToken } from '@src/lib/bounded-contexts/iam/authentication/constants';

backend/src/bounded-contexts/iam/iam/repository/user-write.repository.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import {
1515
ClientSession,
1616
} from 'mongodb';
1717
import * as jwtwebtoken from 'jsonwebtoken';
18-
import { UserWriteRepoPort } from '@src/lib/bounded-contexts/iam/authentication/ports/UserWriteRepoPort';
19-
import { UserEntity } from '@src/lib/bounded-contexts/iam/authentication/domain/UserEntity';
20-
import { EmailVO } from '@src/lib/bounded-contexts/iam/authentication/domain/EmailVO';
18+
import { UserWriteRepoPort } from '@src/lib/bounded-contexts/iam/authentication/ports/user-write.repo-port';
19+
import { UserEntity } from '@src/lib/bounded-contexts/iam/authentication/domain/user.entity';
20+
import { EmailVO } from '@src/lib/bounded-contexts/iam/authentication/domain/email.value-object';
2121
import { ConfigService } from '@nestjs/config';
2222
import { AuthEnvironmentVariables } from '@src/config/auth.configuration';
2323
import { StreamingDomainEventBusToken } from '@src/lib/bounded-contexts/iam/authentication/constants';

backend/src/bounded-contexts/marketing/marketing/marketing.module.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,28 @@ import { Module } from '@nestjs/common';
22

33
import { MarketingModule as LibMarketingModule } from 'src/lib/bounded-contexts/marketing/marketing/marketing.module';
44
import { UserWriteRepository } from './repository/user-write.repository';
5-
import { UserWriteRepoPortToken } from '@src/lib/bounded-contexts/marketing/marketing/ports/user-write.repo-port';
6-
import { NotificationTemplateReadRepoPortToken } from '@src/lib/bounded-contexts/marketing/marketing/ports/notification-template-read.repo-port.';
75
import { NotificationTemplateReadRepository } from './repository/notification-template.repository';
86
import {
97
EmailServicePortToken,
8+
NotificationTemplateReadRepoPortToken,
9+
PubSubIntegrationEventBusToken,
1010
StreamingCommandBusToken,
11+
StreamingDomainEventBusToken,
12+
StreamingIntegrationEventBusToken,
13+
UserWriteRepoPortToken,
1114
} from '@src/lib/bounded-contexts/marketing/marketing/constants';
1215
import { MockEmailService } from './service';
1316
import { MongoModule } from '@bitloops/bl-boilerplate-infra-mongo';
14-
import { StreamingIntegrationEventHandlers } from '@src/lib/bounded-contexts/marketing/marketing/application/event-handlers';
17+
import { StreamingIntegrationEventHandlers } from '@src/lib/bounded-contexts/marketing/marketing/application/event-handlers/integration';
1518
import { StreamingCommandHandlers } from '@src/lib/bounded-contexts/marketing/marketing/application/command-handlers';
1619
import {
1720
NatsStreamingCommandBus,
1821
JetstreamModule,
22+
NatsStreamingDomainEventBus,
23+
NatsStreamingIntegrationEventBus,
24+
NatsPubSubIntegrationEventsBus,
1925
} from '@bitloops/bl-boilerplate-infra-nest-jetstream';
26+
import { StreamingDomainEventHandlers } from '@src/lib/bounded-contexts/marketing/marketing/application/event-handlers/domain';
2027

2128
const RepoProviders = [
2229
{
@@ -35,6 +42,18 @@ const RepoProviders = [
3542
provide: StreamingCommandBusToken,
3643
useClass: NatsStreamingCommandBus,
3744
},
45+
{
46+
provide: StreamingDomainEventBusToken,
47+
useClass: NatsStreamingDomainEventBus,
48+
},
49+
{
50+
provide: StreamingIntegrationEventBusToken,
51+
useClass: NatsStreamingIntegrationEventBus,
52+
},
53+
{
54+
provide: PubSubIntegrationEventBusToken,
55+
useClass: NatsPubSubIntegrationEventsBus,
56+
},
3857
];
3958
@Module({
4059
imports: [
@@ -45,6 +64,7 @@ const RepoProviders = [
4564
JetstreamModule.forFeature({
4665
moduleOfHandlers: MarketingModule,
4766
streamingIntegrationEventHandlers: [...StreamingIntegrationEventHandlers],
67+
streamingDomainEventHandlers: [...StreamingDomainEventHandlers],
4868
streamingCommandHandlers: [...StreamingCommandHandlers],
4969
}),
5070
],

backend/src/bounded-contexts/marketing/marketing/repository/notification-template.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Injectable, Inject } from '@nestjs/common';
22
import { Collection, MongoClient } from 'mongodb';
33
import * as jwtwebtoken from 'jsonwebtoken';
4-
import { NotificationTemplateReadRepoPort } from '@src/lib/bounded-contexts/marketing/marketing/ports/notification-template-read.repo-port.';
5-
import { NotificationTemplateReadModel } from '@src/lib/bounded-contexts/marketing/marketing/domain/read-models/notification-template.read-model';
4+
import { NotificationTemplateReadRepoPort } from '@src/lib/bounded-contexts/marketing/marketing/ports/notification-template-read.repo-port';
5+
import { NotificationTemplateReadModel } from '@src/lib/bounded-contexts/marketing/marketing/domain/notification-template.read-model';
66
import { AuthEnvironmentVariables } from '@src/config/auth.configuration';
77
import { ConfigService } from '@nestjs/config';
88
import {

backend/src/bounded-contexts/marketing/marketing/repository/user-write.repository.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
Application,
33
Domain,
44
Either,
5+
Infra,
56
asyncLocalStorage,
67
ok,
78
} from '@bitloops/bl-boilerplate-core';
@@ -12,6 +13,7 @@ import { UserEntity } from '@src/lib/bounded-contexts/marketing/marketing/domain
1213
import { UserWriteRepoPort } from '@src/lib/bounded-contexts/marketing/marketing/ports/user-write.repo-port';
1314
import { ConfigService } from '@nestjs/config';
1415
import { AuthEnvironmentVariables } from '@src/config/auth.configuration';
16+
import { StreamingDomainEventBusToken } from '@src/lib/bounded-contexts/marketing/marketing/constants';
1517

1618
const MONGO_DB_DATABASE = process.env.MONGO_DB_DATABASE || 'marketing';
1719
const MONGO_DB_TODO_COLLECTION =
@@ -26,6 +28,8 @@ export class UserWriteRepository implements UserWriteRepoPort {
2628

2729
constructor(
2830
@Inject('MONGO_DB_CONNECTION') private client: MongoClient,
31+
@Inject(StreamingDomainEventBusToken)
32+
private readonly domainEventBus: Infra.EventBus.IEventBus,
2933
private configService: ConfigService<AuthEnvironmentVariables, true>,
3034
) {
3135
this.collection = this.client
@@ -59,6 +63,8 @@ export class UserWriteRepository implements UserWriteRepoPort {
5963
$set: userInfo,
6064
},
6165
);
66+
67+
this.domainEventBus.publish(user.domainEvents);
6268
return ok();
6369
}
6470

@@ -113,6 +119,7 @@ export class UserWriteRepository implements UserWriteRepoPort {
113119
...createdUser,
114120
});
115121

122+
this.domainEventBus.publish(user.domainEvents);
116123
return ok();
117124
}
118125
}

backend/src/bounded-contexts/marketing/marketing/service/mock-email.service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { Application, Either, ok } from '@bitloops/bl-boilerplate-core';
22
import { Injectable } from '@nestjs/common';
3-
import {
4-
EmailServicePort,
5-
SendEmailRequest,
6-
} from 'src/lib/bounded-contexts/marketing/marketing/ports/email-service-port';
3+
import { EmailServicePort } from '@src/lib/bounded-contexts/marketing/marketing/ports/email.service-port';
4+
import { SendEmailRequest } from '@src/lib/bounded-contexts/marketing/marketing/structs/send-email-request.struct';
75

86
@Injectable()
97
export class MockEmailService implements EmailServicePort {

0 commit comments

Comments
 (0)