-
Notifications
You must be signed in to change notification settings - Fork 1
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
[CHORE] Saving sent mail list in db #485
Conversation
29cf36b
to
4181c84
Compare
backend/src/mail/mail.service.ts
Outdated
this.logger.log(res?.data); | ||
|
||
const batch = | ||
res.data.txId && |
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.
Seems overkill to do this given the check in line 271
backend/src/mail/mail.service.ts
Outdated
`Emails sent for ${templateType}: ${res.data.messages.length}`, | ||
); | ||
|
||
if (!res.data.txId) { |
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.
Need to do !res?.data?.txId
?
backend/src/mail/mail.service.ts
Outdated
}); | ||
}); | ||
|
||
mails.length > 0 && (await this.mailRepository.save(mails)); |
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.
By and large, I'd prefer using if statements to && just because they're more self explanatory.
Also, in this case, mails could technically be empty from line 289 if, for example, batch
is undefined for any reason, so this could crash when mails.length
is searching for length of undefined
backend/src/mail/mail.service.ts
Outdated
(itm) => !existingEmails?.includes(itm.to[0]), | ||
); | ||
|
||
if (existingEmails?.length > 0) { |
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.
filteredEmails?.length
backend/src/mail/mail.service.ts
Outdated
}), | ||
); | ||
|
||
if (batch.txId && res.data?.messages.length > 0) { |
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.
res.data?.messages?.length
?
|
CHORE
deployed and tested on dev
Objective: