Skip to content

Commit b00d2f3

Browse files
committed
feat(api): something
1 parent 4d42269 commit b00d2f3

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/routes/api/guilds/[guild]/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports.get = fastify => ({
55
handler: async (req, res) => {
66
const { client } = req.routeOptions.config;
77
const guild = client.guilds.cache.get(req.params.guild);
8-
if (!guild) return res.status(404).send(new Error('Not Found'));
98
res.send({
109
id: guild.id,
1110
logo: iconURL(guild),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports.get = fastify => ({
2+
handler: async (req, res) => {
3+
const { client } = req.routeOptions.config;
4+
/** @type {import("@prisma/client").PrismaClient} */
5+
const prisma = client.prisma;
6+
const guild = client.guilds.cache.get(req.params.guild);
7+
res.send(
8+
await prisma.ticket.findMany({
9+
where: {
10+
createdById: req.user.id,
11+
guildId: guild.id,
12+
},
13+
}),
14+
);
15+
},
16+
onRequest: [fastify.authenticate, fastify.isMember],
17+
});
18+

0 commit comments

Comments
 (0)