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
37 changes: 37 additions & 0 deletions notification/sendMail.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@


Scenario: Editing grade

Given The student "Marcos Almeida" has achieved "MPA, MPA, -" for the evaluated learning goals
And I’m at the "Editing grades" page
When I confirm grades to the system
Then I go to "grades" page
And I see the new grade to "Marcos Almeida"
and the student "Marcos Almeida" receive a email from the system

Scenario:

Given The student "Valeria Almeida" has achieved "MANA, MANA, -" for the evaluated learning goals
And I’m at the "Editing grades" page
When I confirm grades to the system
Then I go to "grades" page
And I see the new grade to "Valeria Almeida"
and the student "Valeria Almeida" receive a email from the system

Scenario: Editing grade for the second time

Given The student "Marcos Almeida" has achieved "MPA, MPA, -" for the evaluated learning goals
And I’m at the "Editing grades" page
When I confirm grades to the system
Then I go to "grades" page
And I see the new grade to "Marcos Almeida" a
and the student "Marcos Almeida" don't receive a email from the system because he alredy received once today

Scenario: Editing grade for the second time

Given The student "Valeria Almeida" has achieved "MPA, MPA, -" for the evaluated learning goals
And I’m at the "Editing grades" page
When I confirm grades to the system
Then I go to "grades" page
And I see the new grade to "Valeria Almeida" a
and the student "Valeria Almeida" don't receive a email from the sgiystem because he alredy received once today
31 changes: 31 additions & 0 deletions server/mailService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Função para enviar e-mail ao aluno.
* @param {string} studentName - Nome do aluno.
* @param {string} email - Endereço de e-mail do aluno.
* @param {string} message - Mensagem a ser enviada.
* @returns {Promise<void>}
*/
export async function sendEmail(studentName, email, message) {
try {
const response = await fetch('/api/send-email', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
studentName,
email,
message,
}),
});

if (!response.ok) {
throw new Error('Falha ao enviar o e-mail');
}

console.log(`E-mail enviado com sucesso para ${studentName}`);
} catch (error) {
console.error('Erro ao enviar e-mail:', error);
throw error;
}
}