mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-01-11 02:16:26 +02:00
feat(api): something
This commit is contained in:
parent
4d42269a35
commit
b00d2f312e
@ -5,7 +5,6 @@ module.exports.get = fastify => ({
|
|||||||
handler: async (req, res) => {
|
handler: async (req, res) => {
|
||||||
const { client } = req.routeOptions.config;
|
const { client } = req.routeOptions.config;
|
||||||
const guild = client.guilds.cache.get(req.params.guild);
|
const guild = client.guilds.cache.get(req.params.guild);
|
||||||
if (!guild) return res.status(404).send(new Error('Not Found'));
|
|
||||||
res.send({
|
res.send({
|
||||||
id: guild.id,
|
id: guild.id,
|
||||||
logo: iconURL(guild),
|
logo: iconURL(guild),
|
||||||
|
18
src/routes/api/guilds/[guild]/tickets/@me.js
Normal file
18
src/routes/api/guilds/[guild]/tickets/@me.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
module.exports.get = fastify => ({
|
||||||
|
handler: async (req, res) => {
|
||||||
|
const { client } = req.routeOptions.config;
|
||||||
|
/** @type {import("@prisma/client").PrismaClient} */
|
||||||
|
const prisma = client.prisma;
|
||||||
|
const guild = client.guilds.cache.get(req.params.guild);
|
||||||
|
res.send(
|
||||||
|
await prisma.ticket.findMany({
|
||||||
|
where: {
|
||||||
|
createdById: req.user.id,
|
||||||
|
guildId: guild.id,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
onRequest: [fastify.authenticate, fastify.isMember],
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user