-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpersonagem.js
More file actions
47 lines (43 loc) · 1.25 KB
/
personagem.js
File metadata and controls
47 lines (43 loc) · 1.25 KB
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
43
44
45
46
47
const mongoose = require('mongoose');
const personagemSchema = new mongoose.Schema({
id: Number,
nome: { type: String, required: true },
genero: { type: String, required: true },
escola: { type: String, required: true },
dataDeNascimento: String,
anoDeNascimento: Number,
localDeNascimento: String,
casa: String,
estadoCivil: String,
especie: String,
sangue: String,
corDosOlhos: String,
corDoCabelo: String,
varinha: {
madeira: String,
nucleo: String,
tamanho: Number,
},
patrono: String,
bichoPapao: String,
estudanteDeHogwarts: Boolean,
ordemDaFenix: Boolean,
armadaDeDumbledore: Boolean,
ator: String,
vivo: Boolean,
comensalDaMorte: Boolean,
profissao: String,
imagem: String,
assinatura: String,
});
personagemSchema.methods.greetClient = function () {
console.log(`Boas vindas ao ${this.nome}! Posso te ajudar?`);
}
// personagemSchema.statics.findByCuisine = function (cuisine) {
// return this.find({ cuisine: cuisine });
// }
// personagemSchema.statics.findByName = function (name) {
// return this.find({ nome: nome });
// }
const Personagem = mongoose.model('personagem', personagemSchema);
module.exports = Personagem;