-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfactoryReset.ts
More file actions
43 lines (38 loc) · 830 Bytes
/
factoryReset.ts
File metadata and controls
43 lines (38 loc) · 830 Bytes
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
import db, { FactoryReset } from "../index.js"
export const deleteAllUserGuildData = async (guildId: string): Promise<void> => {
await db.userGuildData.deleteMany({
where: {
guildId,
},
})
}
export const deleteAllGuildSettings = async (guildId: string): Promise<void> => {
await db.guild.delete({
where: {
id: guildId,
},
})
await db.guild.create({
data: {
id: guildId,
},
})
}
export const markFactoryReset = async (guildId: string, executorId: string): Promise<FactoryReset> => {
const reset = await db.factoryReset.create({
data: {
guildId,
executorId,
resetAt: new Date(),
},
})
return reset
}
export const getFactoryResets = async (guildId: string): Promise<FactoryReset[]> => {
const resets = await db.factoryReset.findMany({
where: {
guildId,
},
})
return resets
}