-
Notifications
You must be signed in to change notification settings - Fork 47
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
Email send task #665
Email send task #665
Conversation
when new campaign application is added the organizer will receive an email
✅ Tests will run for this PR. Once they succeed it can be merged. |
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.
There are some conflicts to be fixed as well
@Injectable() | ||
export class CampaignApplicationService { | ||
private readonly bucketName: string = 'campaignapplication-files' | ||
constructor( | ||
private prisma: PrismaService, | ||
private organizerService: OrganizerService, | ||
private s3: S3Service, | ||
private sendEmail: EmailService, |
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.
please rename to sendEmail to emailService
person: Person, | ||
) { | ||
const userEmail = { to: [person.email] as EmailData[] } | ||
const adminEmail = { to: ['[email protected]'] as EmailData[] } |
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.
Would probably be better to put [email protected]
into env, as it might be used in other places in the future. Something like CAMPAIGN_COORDINATOR_EMAIL
would do I suppose
|
||
await this.sendEmail.sendFromTemplate(mailAdmin, adminEmail, { | ||
bypassUnsubscribeManagement: { enable: true }, | ||
}) |
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 don't see any reason to await sending the emails, since they are not urgent for the response, and are allowed to happen with some delay. Though if there is any valid reason you can do it concurrently with Promise.allSettled, instead of doing it sequential, since neither of the promises are depended by the result of the another one.
Example:
const userEmailPromise = this.sendEmail.sendFromTemplate(mailOrganizer, userEmail, {
bypassUnsubscribeManagement: { enable: true },
})
const adminEmailPromise = this.sendEmail.sendFromTemplate(mailAdmin, adminEmail, {
bypassUnsubscribeManagement: { enable: true },
})
await Promise.allSettled([userEmailPromise, adminEmailPromise])
…aignApplication method
df4319f
to
ab3dbdf
Compare
No description provided.