Adds missing webhook user relationship (#1070)
This commit is contained in:
1 parent
5291dade42
commit
cc25a772a1
4 files changed
+62
-57
No files matched your search
@@ -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,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user