mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-22 15:53:08 +02:00
Add DELETE guild settings route
For completely resetting a guild
This commit is contained in:
parent
41ccd778c6
commit
145514a86b
@ -74,7 +74,7 @@ model Category {
|
||||
discordCategory String @db.VarChar(19)
|
||||
emoji String
|
||||
enableFeedback Boolean @default(false)
|
||||
guild Guild @relation(fields: [guildId], references: [id])
|
||||
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
||||
guildId String @db.VarChar(19)
|
||||
id Int @id @default(autoincrement())
|
||||
image String?
|
||||
@ -161,7 +161,7 @@ model QuestionAnswer {
|
||||
model Tag {
|
||||
content String
|
||||
createdAt DateTime @default(now())
|
||||
guild Guild @relation(fields: [guildId], references: [id])
|
||||
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
||||
guildId String @db.VarChar(19)
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
@ -191,7 +191,7 @@ model Ticket {
|
||||
feedbackId Int?
|
||||
firstResponseAt DateTime?
|
||||
deleted Boolean @default(false)
|
||||
guild Guild @relation(fields: [guildId], references: [id])
|
||||
guild Guild @relation(fields: [guildId], references: [id], onDelete: Cascade)
|
||||
guildId String @db.VarChar(19)
|
||||
id String @id @db.VarChar(19)
|
||||
lastMessageAt DateTime?
|
||||
|
@ -1,3 +1,16 @@
|
||||
module.exports.delete = fastify => ({
|
||||
handler: async (req, res) => {
|
||||
/** @type {import('../../../../../client')} */
|
||||
const client = res.context.config.client;
|
||||
|
||||
await client.prisma.guild.delete({ where: { id: req.params.guild } });
|
||||
const settings = await client.prisma.guild.create({ data: { id: req.params.guild } });
|
||||
|
||||
res.send(settings);
|
||||
},
|
||||
onRequest: [fastify.authenticate, fastify.isAdmin],
|
||||
});
|
||||
|
||||
module.exports.get = fastify => ({
|
||||
handler: async (req, res) => {
|
||||
/** @type {import('../../../../../client')} */
|
||||
|
Loading…
Reference in New Issue
Block a user