feat(mentor): round-open emails now carry team-member contacts
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -232,7 +232,13 @@ export async function activateRound(
|
|||||||
id: true,
|
id: true,
|
||||||
mentorId: true,
|
mentorId: true,
|
||||||
mentor: { select: { name: true, email: true } },
|
mentor: { select: { name: true, email: true } },
|
||||||
project: { select: { id: true, title: true } },
|
project: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
teamMembers: { select: { user: { select: { name: true, email: true } } } },
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const perMentor = new Map<
|
const perMentor = new Map<
|
||||||
@@ -241,7 +247,7 @@ export async function activateRound(
|
|||||||
email: string | null
|
email: string | null
|
||||||
name: string | null
|
name: string | null
|
||||||
assignmentIds: string[]
|
assignmentIds: string[]
|
||||||
projects: { id: string; title: string }[]
|
projects: { id: string; title: string; teamMembers: { name: string | null; email: string }[] }[]
|
||||||
}
|
}
|
||||||
>()
|
>()
|
||||||
for (const a of pendingAssignments) {
|
for (const a of pendingAssignments) {
|
||||||
@@ -253,7 +259,13 @@ export async function activateRound(
|
|||||||
projects: [],
|
projects: [],
|
||||||
}
|
}
|
||||||
bucket.assignmentIds.push(a.id)
|
bucket.assignmentIds.push(a.id)
|
||||||
bucket.projects.push({ id: a.project.id, title: a.project.title })
|
bucket.projects.push({
|
||||||
|
id: a.project.id,
|
||||||
|
title: a.project.title,
|
||||||
|
teamMembers: a.project.teamMembers
|
||||||
|
.filter((tm) => tm.user?.email)
|
||||||
|
.map((tm) => ({ name: tm.user.name, email: tm.user.email })),
|
||||||
|
})
|
||||||
perMentor.set(a.mentorId, bucket)
|
perMentor.set(a.mentorId, bucket)
|
||||||
}
|
}
|
||||||
for (const bucket of perMentor.values()) {
|
for (const bucket of perMentor.values()) {
|
||||||
@@ -336,8 +348,13 @@ export async function activateRound(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const allMembers = p.teamMembers
|
||||||
|
.filter((tm) => tm.user?.email)
|
||||||
|
.map((tm) => ({ name: tm.user.name, email: tm.user.email }))
|
||||||
|
|
||||||
for (const [email, { name }] of recipients) {
|
for (const [email, { name }] of recipients) {
|
||||||
await sendTeamMentorIntroductionEmail(email, name, p.title, p.id, mentors)
|
const teammates = allMembers.filter((m) => m.email !== email)
|
||||||
|
await sendTeamMentorIntroductionEmail(email, name, p.title, p.id, mentors, teammates)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stamp every mentor-assignment row so re-activation doesn't re-send.
|
// Stamp every mentor-assignment row so re-activation doesn't re-send.
|
||||||
|
|||||||
Reference in New Issue
Block a user