mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
Add GET guild settings route
This commit is contained in:
parent
c082552fae
commit
cb4013337f
@ -111,7 +111,7 @@ model Feedback {
|
||||
model Guild {
|
||||
autoTag Json?
|
||||
archive Boolean @default(true)
|
||||
blocklist Json
|
||||
blocklist Json @default("[]")
|
||||
categories Category[]
|
||||
createdAt DateTime @default(now())
|
||||
errorColour String @default("RED")
|
||||
|
@ -1,7 +1,11 @@
|
||||
module.exports.get = fastify => ({
|
||||
handler: (req, res) => {
|
||||
const { client } = res.context.config;
|
||||
return client.guilds.cache.get(req.params.guild);
|
||||
handler: async (req, res) => {
|
||||
/** @type {import('../../../../../client')} */
|
||||
const client = res.context.config.client;
|
||||
|
||||
const settings = await client.prisma.guild.findUnique({ where: { id: req.params.guild } }) ??
|
||||
await client.prisma.guild.create({ data: { id: req.params.guild } });
|
||||
res.send(settings);
|
||||
},
|
||||
onRequest: [fastify.authenticate],
|
||||
onRequest: [fastify.authenticate, fastify.isAdmin],
|
||||
});
|
Loading…
Reference in New Issue
Block a user