Adds missing webhook user relationship (#1070)

This commit is contained in:
Omar López authored and GitHub committed 2021-10-29 08:13:51 -06:00
1 parent 5291dade42
commit cc25a772a1
4 files changed
+62 -57

No files matched your search

+10 -11
View File
@@ -65,21 +65,20 @@ export const webhookRouter = createProtectedRouter()
}),
async resolve({ ctx, input }) {
const { id } = input;
const webhook = await ctx.prisma.webhook.findFirst({
await ctx.prisma.user.update({
where: {
userId: ctx.user.id,
id,
id: ctx.user.id,
},
});
if (!webhook) {
// user does not own this webhook
return null;
}
await ctx.prisma.webhook.delete({
where: {
id,
data: {
webhooks: {
delete: {
id,
},
},
},
});
return {
id,
};