-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.js
61 lines (57 loc) · 1.62 KB
/
database.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const mongoose = require('mongoose');
require('dotenv').config()
class Database {
connection = undefined;
constructor(){
var url = process.env.DB_PASS;
this.connection = mongoose.createConnection(url);
this.connection.model('Experiencia', new mongoose.Schema({
id: String,
userName: String,
exp: Number,
level: Number,
group: String,
groupName: String,
nextLevelExp: Number
}, {
collection: 'WhatsApp'
}));
this.connection.model('PokemonPlayer', new mongoose.Schema({
id: String,
repel: Boolean,
playing: Boolean,
pokemon: Array,
itens: Array,
coins: Number,
hasStarter: Boolean
}, {
collection: 'PokemonPlayerModule'
}));
this.connection.model('PokemonBox', new mongoose.Schema({
id: String,
boxId: Boolean,
pokemon: Array
}, {
collection: 'PokemonBoxModule'
}));
this.connection.model('Cache', new mongoose.Schema({
info: Object,
name: String
}, {
collection: 'Cache'
}));
this.connection.model('ModuleSwitch', new mongoose.Schema({
groupId: String,
groupName: String,
epicGames: Boolean,
pokeBom: Boolean,
}, {
collection: 'ModuleSwitch'
}));
};
getModel(name){
return this.connection.model(name);
}
}
const _db = new Database();
module.exports = _db;