mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 17:23:08 +02:00
Add PATCH guild settings route
This commit is contained in:
parent
cb4013337f
commit
66b46cf3e2
@ -5,6 +5,22 @@ module.exports.get = fastify => ({
|
|||||||
|
|
||||||
const settings = await client.prisma.guild.findUnique({ where: { id: req.params.guild } }) ??
|
const settings = await client.prisma.guild.findUnique({ where: { id: req.params.guild } }) ??
|
||||||
await client.prisma.guild.create({ data: { id: req.params.guild } });
|
await client.prisma.guild.create({ data: { id: req.params.guild } });
|
||||||
|
|
||||||
|
res.send(settings);
|
||||||
|
},
|
||||||
|
onRequest: [fastify.authenticate, fastify.isAdmin],
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports.patch = fastify => ({
|
||||||
|
handler: async (req, res) => {
|
||||||
|
/** @type {import('../../../../../client')} */
|
||||||
|
const client = res.context.config.client;
|
||||||
|
|
||||||
|
const settings = await client.prisma.guild.update({
|
||||||
|
data: req.body,
|
||||||
|
where: { id: req.params.guild },
|
||||||
|
});
|
||||||
|
|
||||||
res.send(settings);
|
res.send(settings);
|
||||||
},
|
},
|
||||||
onRequest: [fastify.authenticate, fastify.isAdmin],
|
onRequest: [fastify.authenticate, fastify.isAdmin],
|
||||||
|
Loading…
Reference in New Issue
Block a user