mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 08:13: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 {
|
model Guild {
|
||||||
autoTag Json?
|
autoTag Json?
|
||||||
archive Boolean @default(true)
|
archive Boolean @default(true)
|
||||||
blocklist Json
|
blocklist Json @default("[]")
|
||||||
categories Category[]
|
categories Category[]
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
errorColour String @default("RED")
|
errorColour String @default("RED")
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
module.exports.get = fastify => ({
|
module.exports.get = fastify => ({
|
||||||
handler: (req, res) => {
|
handler: async (req, res) => {
|
||||||
const { client } = res.context.config;
|
/** @type {import('../../../../../client')} */
|
||||||
return client.guilds.cache.get(req.params.guild);
|
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