-
Notifications
You must be signed in to change notification settings - Fork 0
/
GerenciadorGraduatesOn25.js
42 lines (34 loc) · 1.04 KB
/
GerenciadorGraduatesOn25.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const GraduatesOn25 = require('./GraduatesOn25');
class GerenciadorGraduatesOn25 extends GraduatesOn25 {
constructor() {
super();
this.graduates = [];
}
adicionarGraduada(id, nome, email, linkedin, github, area) {
const graduada = new GraduatesOn25(id, nome, email, linkedin, github, area);
this.graduates.push(graduada);
}
listarGraduadas() {
return this.graduates;
}
buscarGraduadaPorId(id) {
return this.graduates.find(graduada => graduada.id === id);
}
atualizarGraduada(id, novoNome, novoEmail, novoLinkedin, novoGithub, novaArea) {
const graduada = this.buscarGraduadaPorId(id);
if (graduada) {
graduada.nome = novoNome;
graduada.email = novoEmail;
graduada.linkedin = novoLinkedin;
graduada.github = novoGithub;
graduada.area = novaArea;
}
}
removerGraduada(id) {
const index = this.graduates.findIndex(graduada => graduada.id === id);
if (index !== -1) {
this.graduates.splice(index, 1);
}
}
}
module.exports = GerenciadorGraduatesOn25;