Skip to content

Commit

Permalink
feat(api): something
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Jul 3, 2024
1 parent 4d42269 commit b00d2f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/routes/api/guilds/[guild]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports.get = fastify => ({
handler: async (req, res) => {
const { client } = req.routeOptions.config;
const guild = client.guilds.cache.get(req.params.guild);
if (!guild) return res.status(404).send(new Error('Not Found'));
res.send({
id: guild.id,
logo: iconURL(guild),
Expand Down
18 changes: 18 additions & 0 deletions src/routes/api/guilds/[guild]/tickets/@me.js
Original file line number Diff line number Diff line change
@@ -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],
});

0 comments on commit b00d2f3

Please sign in to comment.