Skip to content

Commit 5aea393

Browse files
authored
fix(409):correcting email sent to trainee (#426)
1 parent eec65aa commit 5aea393

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/resolvers/coordinatorResolvers.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { pushNotification } from '../utils/notification/pushNotification'
1414
import { sendEmail } from '../utils/sendEmail'
1515
import generalTemplate from '../utils/templates/generalTemplate'
1616
import getOrganizationTemplate from '../utils/templates/getOrganizationTemplate'
17-
import inviteUserTemplate from '../utils/templates/inviteUserTemplate'
1817
import RemoveTraineeTemplate from '../utils/templates/removeTraineeTamplete'
1918
import { Context } from './../context'
2019
import { Document, ObjectId } from 'mongoose'
@@ -43,6 +42,10 @@ interface Cohort extends Document {
4342
interface Team extends Document {
4443
cohort: Cohort
4544
}
45+
const team = {
46+
cohort: { name: 'Your Cohort Name' },
47+
name: 'Team Name'
48+
};
4649

4750
const manageStudentResolvers = {
4851
Query: {
@@ -450,7 +453,9 @@ const manageStudentResolvers = {
450453
try {
451454
const content = getOrganizationTemplate(
452455
org!.name,
453-
`${process.env.FRONTEND_LINK}/login/org`
456+
`${process.env.FRONTEND_LINK}/login/org`,
457+
team.cohort.name,
458+
team.name
454459
)
455460
await sendEmailOnMembershipActions(
456461
role,
@@ -907,7 +912,9 @@ async function sendEmailOnMembershipActions(
907912
if (program.organization._id.toString() == org?.id.toString()) {
908913
const content = getOrganizationTemplate(
909914
org!.name,
910-
`${process.env.FRONTEND_LINK}/login/org`
915+
`${process.env.FRONTEND_LINK}/login/org`,
916+
team.cohort.name,
917+
team.name
911918
)
912919
const link: any = process.env.FRONTEND_LINK + '/login/org'
913920
await sendEmail(
@@ -934,7 +941,9 @@ async function sendEmailOnMembershipActions(
934941
if (program.organization._id.toString() == org?.id.toString()) {
935942
const content = getOrganizationTemplate(
936943
org!.name,
937-
`${process.env.FRONTEND_LINK}/login/org`
944+
`${process.env.FRONTEND_LINK}/login/org`,
945+
team.cohort.name,
946+
team.name
938947
)
939948
const link: any = process.env.FRONTEND_LINK + '/login/org'
940949
await sendEmail(
@@ -952,3 +961,7 @@ async function sendEmailOnMembershipActions(
952961
}
953962

954963
export default manageStudentResolvers
964+
function inviteUserTemplate(arg0: string, link: string, arg2: string) {
965+
throw new Error('Function not implemented.')
966+
}
967+

src/utils/templates/getOrganizationTemplate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const link = process.env.FRONTEND_LINK + '/login/org'
22

3-
export default function Template(orgName: string, link: string) {
3+
export default function Template(orgName: string, link: string, cohortName: string, teamName: string) {
44
return /* html */ `
55
<table style="font-size: 16px; font-family: 'Rubik'; text-align: left">
66
<tbody>
@@ -10,7 +10,7 @@ export default function Template(orgName: string, link: string) {
1010
<br />
1111
1212
<p style="margin-bottom: 5px">
13-
You have been added to the <strong>${orgName}</strong> organization. You will now use it to login from here on.
13+
You have been added to the <strong>${orgName}</strong> organization in <strong> ${cohortName}</strong>, <strong> ${teamName}</strong>. You will now use it to login from here on.
1414
</p>
1515
<p style="margin-bottom: 10px">
1616
Use the button below to login into the organization.

0 commit comments

Comments
 (0)