This repository has been archived by the owner on Jul 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.js
90 lines (85 loc) · 1.75 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const { connect, Schema, model, set } = require("mongoose");
const { ChalkAdvanced } = require("chalk-advanced");
set("strictQuery", true);
connect(process.env.DB, {})
.then(() =>
console.log(
`${ChalkAdvanced.gray(">")} ${ChalkAdvanced.green(
"✅ • Carregado com sucesso [BANCO DE DADOS]"
)}`
)
)
.catch(() =>
console.log(
`${ChalkAdvanced.gray(">")} ${ChalkAdvanced.red(
"❎ • Conexão do banco de dados falhada"
)}`
)
);
const guildSchema = new Schema({
_id: { type: String, required: true },
vipschedule: [
{
_id: String,
vip: String,
schedule: Date,
},
],
roleschedule: [
{
_id: String,
role: String,
schedule: Date,
},
],
partnerschedule: [
{
_id: String,
schedule: Date,
},
],
});
const staffsSchema = new Schema({
_id: { type: String, required: true },
cargo: String,
days: [
{
0: Boolean,
1: Boolean,
2: Boolean,
3: Boolean,
4: Boolean,
5: Boolean,
6: Boolean,
},
],
ausente: [
{
status: Boolean,
endTime: Date,
},
],
weekStatus: [
{
messages: Number,
},
],
});
const userSchema = new Schema({
_id: { type: String, required: true },
vips: {
roleid: String,
rolelimit: { type: Number, default: 0 },
channelimit: { type: Number, default: 0 },
},
coins: Number,
});
const questionSchema = new Schema({
_id: { type: String, required: true },
answer: String,
difficulty: String,
});
module.exports.Staffs = model("Staffs", staffsSchema);
module.exports.Guilds = model("Guilds", guildSchema);
module.exports.Users = model("Users", userSchema);
module.exports.Questions = model("Questions", questionSchema);