use new integration events

This commit is contained in:
sbriat
2023-07-24 16:02:49 +02:00
parent 66bfa89e8f
commit 3d746df9bc
4 changed files with 11 additions and 11 deletions

View File

@@ -13,10 +13,10 @@ export class UserDeletedMessageHandler {
public async userDeleted(message: string) {
const deletedUser = JSON.parse(message);
try {
if (!deletedUser.hasOwnProperty('userId')) throw new Error();
if (!deletedUser.hasOwnProperty('id')) throw new Error();
await this.commandBus.execute(
new DeleteAuthenticationCommand({
userId: deletedUser.userId,
userId: deletedUser.id,
}),
);
} catch (e: any) {}

View File

@@ -14,11 +14,11 @@ export class UserUpdatedMessageHandler {
public async userUpdated(message: string) {
const updatedUser = JSON.parse(message);
try {
if (!updatedUser.hasOwnProperty('userId')) throw new Error();
if (!updatedUser.hasOwnProperty('id')) throw new Error();
if (updatedUser.hasOwnProperty('email') && updatedUser.email) {
await this.commandBus.execute(
new UpdateUsernameCommand({
userId: updatedUser.userId,
userId: updatedUser.id,
username: {
name: updatedUser.email,
type: Type.EMAIL,
@@ -29,7 +29,7 @@ export class UserUpdatedMessageHandler {
if (updatedUser.hasOwnProperty('phone') && updatedUser.phone) {
await this.commandBus.execute(
new UpdateUsernameCommand({
userId: updatedUser.userId,
userId: updatedUser.if,
username: {
name: updatedUser.phone,
type: Type.PHONE,