mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 09:23:07 +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)
|
discordCategory String @db.VarChar(19)
|
||||||
emoji String
|
emoji String
|
||||||
enableFeedback Boolean @default(false)
|
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)
|
guildId String @db.VarChar(19)
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
image String?
|
image String?
|
||||||
@ -161,7 +161,7 @@ model QuestionAnswer {
|
|||||||
model Tag {
|
model Tag {
|
||||||
content String
|
content String
|
||||||
createdAt DateTime @default(now())
|
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)
|
guildId String @db.VarChar(19)
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
name String
|
name String
|
||||||
@ -191,7 +191,7 @@ model Ticket {
|
|||||||
feedbackId Int?
|
feedbackId Int?
|
||||||
firstResponseAt DateTime?
|
firstResponseAt DateTime?
|
||||||
deleted Boolean @default(false)
|
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)
|
guildId String @db.VarChar(19)
|
||||||
id String @id @db.VarChar(19)
|
id String @id @db.VarChar(19)
|
||||||
lastMessageAt DateTime?
|
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 => ({
|
module.exports.get = fastify => ({
|
||||||
handler: async (req, res) => {
|
handler: async (req, res) => {
|
||||||
/** @type {import('../../../../../client')} */
|
/** @type {import('../../../../../client')} */
|
||||||
|
Loading…
Reference in New Issue
Block a user