-
Notifications
You must be signed in to change notification settings - Fork 2
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
Implement sending bulk notifications #26
Conversation
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.
Thanks @mohammadranjbarz , It looks good.
Just one concern must be addressed, mentioned in another comment
const { microService } = params; | ||
try { | ||
validateWithJoiSchema(body, sendBulkNotificationValidator); | ||
await Promise.all( |
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.
What will happen if two events have the same trackId? We have made that field unique in the schema, so normally it must throw an error! but the problem is that some notifications will be created and some not!
@mohammadranjbarz Can you write a test to examine it?
If you agree with to change it, the best way in my view is to put all tackIds in a Set
and compare its size with the notifications size.
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.
Note, only duplicates in current notifications may cause a problem. If we have a trackId saved before this request, it will only gracefully ignored.
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.
Thanks @aminlatifi , your suggestion was good, I did it.
…ulk notifications related to #24
related to #24