-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 CreateNotificationJobCommand fix - update templateProviderIds Map to Record. #3614
🐛 CreateNotificationJobCommand fix - update templateProviderIds Map to Record. #3614
Conversation
@djabarovgeorge do we have any way to create a test case for this value? I think it's the second time it's doing problems :( |
Do you mean that |
@djabarovgeorge yes, it caused some issue previously with undefined values for providerId when the job is created. It was fixed later, but now seems there is another issue in that area. |
@@ -241,14 +242,14 @@ export class TriggerEvent { | |||
channelType | |||
); | |||
if (provider) { | |||
providers.set(channelType, provider); | |||
providers[channelType] = provider; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this to cause problems for example in the email channel with the Novu provider plus the email provider a user might enable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the current logic, I think that this.getProviderId will return not novu integration
if exists. and then set it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and won't return the novu email integration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will first of all return, not Novu integration if exist, and if not it will return Novu's integration.
packages/application-generic/src/usecases/trigger-event/trigger-event.usecase.ts
Outdated
Show resolved
Hide resolved
); | ||
const channel = STEP_TYPE_TO_CHANNEL_TYPE.get( | ||
step.template.type | ||
) as ChannelTypeEnum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we should change the STEP_TYPE_TO_CHANNEL_TYPE
to object as we now need to cast the value always
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the cast was not needed at all so i removed it.
@@ -241,14 +242,14 @@ export class TriggerEvent { | |||
channelType | |||
); | |||
if (provider) { | |||
providers.set(channelType, provider); | |||
providers[channelType] = provider; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and won't return the novu email integration?
@@ -196,6 +196,7 @@ export class SendMessageInApp extends SendMessageBase { | |||
transactionId: command.transactionId, | |||
content: this.storeContent() ? content : null, | |||
payload: messagePayload, | |||
providerId: integration.providerId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
funny thing, we did not save the provider on the message, which also means that the previous query of oldMessage
always failed.
@@ -257,7 +258,7 @@ export class SendMessageInApp extends SendMessageBase { | |||
CreateExecutionDetailsCommand.create({ | |||
...CreateExecutionDetailsCommand.getDetailsFromJob(command.job), | |||
messageId: message._id, | |||
providerId: InAppProviderIdEnum.Novu, | |||
providerId: integration.providerId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added dynamic provider id
@@ -296,7 +297,7 @@ export class SendMessageInApp extends SendMessageBase { | |||
CreateExecutionDetailsCommand.create({ | |||
...CreateExecutionDetailsCommand.getDetailsFromJob(command.job), | |||
messageId: message._id, | |||
providerId: InAppProviderIdEnum.Novu, | |||
providerId: integration.providerId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was not sure where to put it so i left it on the trigger e2e.
What change does this PR introduce?
Changed the templateProviderIds Map to Record.
Why was this change needed?
Looks like the
plainToInstance
(from 'class-transformer') in the BaseCommand is mapping Map values to 'undefined'.Other information (Screenshots)
typestack/class-transformer#1256