Skip to content
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

Con Reminder Emails (Continued) #924

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ export class ConMentorshipMatchesService {
rediLocation: menteeProfile.props.rediLocation,
})

const menteePendingMentorshipMatches = await this.findAll({
const menteependingMenteeApplications = await this.findAll({
helloanil marked this conversation as resolved.
Show resolved Hide resolved
Mentee__c: menteeProfile.props.userId,
Status__c: MentorshipMatchStatus.APPLIED,
})

menteePendingMentorshipMatches.forEach(async (match) => {
menteependingMenteeApplications.forEach(async (match) => {
match.props.status =
MentorshipMatchStatus.INVALIDATED_AS_OTHER_MENTOR_ACCEPTED
katamatata marked this conversation as resolved.
Show resolved Hide resolved
this.api.update(this.mapper.toPersistence(match))
Expand Down
69 changes: 45 additions & 24 deletions apps/nestjs-api/src/reminder-emails/reminder-emails.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class ReminderEmailsController {
}

return {
message: `Complete Profile reminder emails sent to ${mentorsWithDraftingProfile.length} mentors`,
message: `Complete Profile Reminder Emails sent to Mentors: ${mentorsWithDraftingProfile.length}`,
}
}

Expand All @@ -50,7 +50,7 @@ export class ReminderEmailsController {
}

return {
message: `Complete Profile reminder emails sent to ${menteesWithDrafingProfile.length} mentees`,
message: `Complete Profile Reminder Emails Sent to Mentees: ${menteesWithDrafingProfile.length}`,
}
}

Expand Down Expand Up @@ -94,7 +94,7 @@ export class ReminderEmailsController {
}

return {
message: `First reminder emails to apply to a mentor sent to ${firstReminderMentees.length} mentees. Second reminder emails to apply to a mentor sent to ${secondReminderMentees.length} mentees`,
message: `Apply To a Mentor Reminder Emails sent: ${firstReminderMentees.length} first reminders, ${secondReminderMentees.length} second reminders`,
}
}

Expand Down Expand Up @@ -126,33 +126,54 @@ export class ReminderEmailsController {
}

return {
message: `Follow-up reminder emails sent to ${
message: `Mentorship Follow-up Reminder Emails Sent: ${
Object.keys(threeMonthsOldMentorshipMatches).length
} mentorship matches`,
}`,
}
}

// @Get('/s3cr3t-3ndp01nt-t0-tr1gg3r-r3m1nd3r5/mentees-platform-and-new-mentors')
// async sendUnmatchedMenteesReminder() {
// const unmatchedMenteesWithApprovedProfiles =
// await this.reminderEmailsService.getUnmatchedMenteesWithApprovedProfiles()
@Get('/s3cr3t-3ndp01nt-t0-tr1gg3r-r3m1nd3r5/mentees-platform-and-new-mentors')
async sendUnmatchedMenteesReminder() {
const unmatchedMenteesFor45Days =
await this.reminderEmailsService.getUnmatchedMenteesFor45Days()

// if (unmatchedMenteesWithApprovedProfiles.length > 0) {
// // send reminder emails
// unmatchedMenteesWithApprovedProfiles.forEach(async (mentee) => {
// await this.reminderEmailsService.sendMenteesPlatformAndNewMentorsReminder(
// {
// email: mentee.props.email,
// firstName: mentee.props.firstName,
// }
// )
// })
// }
if (Object.keys(unmatchedMenteesFor45Days).length > 0) {
unmatchedMenteesFor45Days.forEach(async (mentee) => {
// Send reminder email to mentee
await this.reminderEmailsService.sendMenteesPlatformAndNewMentorsReminder(
{
email: mentee.props.email,
firstName: mentee.props.firstName,
}
)
})
}

// return {
// message: `Reminder emails sent to ${unmatchedMenteesWithApprovedProfiles.length} unmatched mentees with approved profiles`,
// }
// }
return {
message: `Platform Update Reminder Emails Sent to Mentees: ${unmatchedMenteesFor45Days.length}`,
}
}

@Get('/s3cr3t-3ndp01nt-t0-tr1gg3r-r3m1nd3r5/pending-mentorships')
async sendPendingMenteeApplicationReminder() {
const pendingMenteeApplications =
await this.reminderEmailsService.getPendingMenteeApplications()

katamatata marked this conversation as resolved.
Show resolved Hide resolved
if (Object.keys(pendingMenteeApplications).length > 0) {
Object.keys(pendingMenteeApplications).forEach(async (match) => {
katamatata marked this conversation as resolved.
Show resolved Hide resolved
// Send reminder email to mentee
await this.reminderEmailsService.sendMentorPendingApplicationReminder({
match: pendingMenteeApplications[match],
})
})
}

return {
message: `Pending Mentee Applications Reminder emails sent to Mentors: ${
Object.keys(pendingMenteeApplications).length
}`,
}
}

// @Get('/s3cr3t-3ndp01nt-t0-tr1gg3r-r3m1nd3r5/mentoring-sessions-logging')
// async sendMentoringSessionsLoggingReminder() {
Expand Down
Loading
Loading