-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backend | NestJS CQRS - Upgrade to version 7
- Loading branch information
1 parent
4fd2d33
commit 30b277d
Showing
10 changed files
with
2,680 additions
and
2,364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
"trailingComma": "all", | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
import { Inject, Module, OnModuleInit } from '@nestjs/common'; | ||
import { Module } from '@nestjs/common'; | ||
import { InvitingApplicantsApplicationModule } from './application/inviting-applicants-application.module'; | ||
import { InvitingApplicantsInfrastructureModule } from './infrastructure/inviting-applicants-infrastructure.module'; | ||
import { | ||
CancelApplicantInvitationPublicCommand, | ||
InviteApplicantPublicCommand, | ||
} from '@coders-board-library/public-messages'; | ||
import { InvitingApplicantsExternalCommandHandlersModule } from './presentation/external-command-handlers/inviting-applicants-external-command-handlers.module'; | ||
import { InvitingApplicantsWriteSideRestApiModule } from './presentation/rest-api/inviting-applicants-write-side-rest-api.module'; | ||
import { | ||
EXTERNAL_COMMAND_SENDER, | ||
ExternalCommandSender, | ||
} from '../../shared-kernel/write-side/application/external-command-sender/external-command-sender'; | ||
|
||
const writeRestApi = InvitingApplicantsWriteSideRestApiModule; | ||
const externalCommandHandlers = InvitingApplicantsExternalCommandHandlersModule; | ||
|
@@ -23,38 +15,4 @@ const externalCommandHandlers = InvitingApplicantsExternalCommandHandlersModule; | |
InvitingApplicantsInfrastructureModule, | ||
], | ||
}) | ||
export class InvitingApplicantsWriteSideModule implements OnModuleInit { | ||
constructor( | ||
@Inject(EXTERNAL_COMMAND_SENDER) | ||
private readonly commandBus: ExternalCommandSender, | ||
) {} | ||
|
||
//FIXME: Delete. Just to init some data. | ||
async onModuleInit() { | ||
const person = { | ||
janKowalski: { | ||
personalEmail: '[email protected]', | ||
firstName: 'Jan', | ||
lastName: 'Kowalski', | ||
}, | ||
}; | ||
const inviteCommand = new InviteApplicantPublicCommand( | ||
person.janKowalski.personalEmail, | ||
person.janKowalski.firstName, | ||
person.janKowalski.lastName, | ||
); | ||
const invitationId = await this.commandBus.send(inviteCommand); | ||
if (randomInt(0, 1) === 0) { | ||
setTimeout(() => { | ||
this.commandBus.send(new CancelApplicantInvitationPublicCommand(invitationId)); | ||
}, 2000); | ||
setTimeout(() => { | ||
this.commandBus.send(new CancelApplicantInvitationPublicCommand(invitationId)); | ||
}, 10000); | ||
} | ||
} | ||
} | ||
|
||
function randomInt(min, max) { | ||
return min + Math.floor((max - min) * Math.random()); | ||
} | ||
export class InvitingApplicantsWriteSideModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.