Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 @@ -591,11 +591,13 @@ public InterviewSlotDTO assignSlotToInterviewee(UUID slotId, UUID applicationId)
private void sendInterviewInvitationEmail(InterviewSlot slot, Interviewee interviewee, Job job) {
Application application = interviewee.getApplication();
User applicant = application.getApplicant().getUser();
User professor = job.getSupervisingProfessor();

String icsContent = icsCalendarService.generateIcsContent(slot, job);
String icsFileName = icsCalendarService.generateFileName(slot);

Email email = Email.builder()
// Email to Applicant (with ICS)
Email applicantEmail = Email.builder()
.to(applicant)
.emailType(EmailType.INTERVIEW_INVITATION)
.language(Language.fromCode(applicant.getSelectedLanguage()))
Expand All @@ -604,8 +606,19 @@ private void sendInterviewInvitationEmail(InterviewSlot slot, Interviewee interv
.icsContent(icsContent)
.icsFileName(icsFileName)
.build();
asyncEmailSender.sendAsync(applicantEmail);

asyncEmailSender.sendAsync(email);
// Email to Professor (confirmation with ICS)
Email professorEmail = Email.builder()
.to(professor)
.emailType(EmailType.INTERVIEW_ASSIGNED_PROFESSOR)
.language(Language.fromCode(professor.getSelectedLanguage()))
.researchGroup(job.getResearchGroup())
.content(slot)
.icsContent(icsContent)
.icsFileName(icsFileName)
.build();
asyncEmailSender.sendAsync(professorEmail);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ public enum EmailType {
*/
INTERVIEW_BOOKED_PROFESSOR("INTERVIEW_BOOKED_PROFESSOR", Set.of(UserRole.PROFESSOR, UserRole.EMPLOYEE), false, false),

/**
* Confirmation to professor when they manually assign a slot to an applicant
* To: Supervising professor of the job
*/
INTERVIEW_ASSIGNED_PROFESSOR("INTERVIEW_ASSIGNED_PROFESSOR", Set.of(UserRole.PROFESSOR, UserRole.EMPLOYEE), false, false),

/**
* Invitation to self-schedule an interview slot
* To: Applicant
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<p>Sehr geehrte*r ${PROFESSOR_FIRST_NAME!} ${PROFESSOR_LAST_NAME!},</p>

<p>Sie haben erfolgreich ein Interview mit <strong>${APPLICANT_FIRST_NAME!} ${APPLICANT_LAST_NAME!}</strong> für die
Position <strong>${JOB_TITLE!}</strong> geplant.</p>

<p><strong>Interview-Details:</strong></p>
<ul>
<li><strong>Datum:</strong> ${INTERVIEW_DATE!}</li>
<li><strong>Uhrzeit:</strong> ${INTERVIEW_START_TIME!} – ${INTERVIEW_END_TIME!}</li>
<li><strong>Ort:</strong> ${INTERVIEW_LOCATION!}</li>
</ul>

<p>Eine Kalendereinladung (.ics) ist dieser E-Mail angehängt.</p>

<p>Mit freundlichen Grüßen,<br />Ihr TUMApply Team</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Interview geplant mit ${APPLICANT_FIRST_NAME!} ${APPLICANT_LAST_NAME!}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<p>Dear ${PROFESSOR_FIRST_NAME!} ${PROFESSOR_LAST_NAME!},</p>

<p>You have successfully scheduled an interview with <strong>${APPLICANT_FIRST_NAME!} ${APPLICANT_LAST_NAME!}</strong>
for the position <strong>${JOB_TITLE!}</strong>.</p>

<p><strong>Interview Details:</strong></p>
<ul>
<li><strong>Date:</strong> ${INTERVIEW_DATE!}</li>
<li><strong>Time:</strong> ${INTERVIEW_START_TIME!} – ${INTERVIEW_END_TIME!}</li>
<li><strong>Location:</strong> ${INTERVIEW_LOCATION!}</li>
</ul>

<p>A calendar invitation (.ics) is attached to this email.</p>

<p>Best regards,<br />Your TUMApply Team</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Interview Scheduled with ${APPLICANT_FIRST_NAME!} ${APPLICANT_LAST_NAME!}
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,17 @@ void assignSlotSuccessfullyAssignsInterviewee() {
assertThat(result.isBooked()).isTrue();
assertThat(result.interviewee()).isNotNull();
assertThat(result.interviewee().applicationId()).isEqualTo(application.getApplicationId());

// Verify 2 emails sent: 1 to applicant, 1 to professor
ArgumentCaptor<Email> emailCaptor = ArgumentCaptor.forClass(Email.class);
verify(asyncEmailSenderMock, times(2)).sendAsync(emailCaptor.capture());

List<Email> sentEmails = emailCaptor.getAllValues();
assertThat(sentEmails).hasSize(2);
assertThat(sentEmails.stream().map(Email::getEmailType)).containsExactlyInAnyOrder(
EmailType.INTERVIEW_INVITATION,
EmailType.INTERVIEW_ASSIGNED_PROFESSOR
);
}

@Test
Expand Down
Loading