fix param name in deleteSubcription

This commit is contained in:
aar2dee2 2023-08-31 13:14:34 +05:30
parent d4bb915cc8
commit c4bfe98798
3 changed files with 6 additions and 6 deletions

View File

@ -67,11 +67,11 @@ export async function addSubscription({
export async function deleteSubscription({
appApiKey,
webhookId,
appName,
appId,
}: {
appApiKey: ApiKey;
webhookId: string;
appName: string;
appId: string;
}) {
try {
const webhook = await prisma.webhook.findFirst({
@ -94,7 +94,7 @@ export async function deleteSubscription({
});
for (const booking of bookingsWithScheduledJobs) {
const updatedScheduledJobs = booking.scheduledJobs.filter(
(scheduledJob) => scheduledJob !== `${appName}_${webhook.id}`
(scheduledJob) => scheduledJob !== `${appId}_${webhook.id}`
);
await prisma.booking.update({
where: {
@ -118,7 +118,7 @@ export async function deleteSubscription({
return deleteWebhook;
} catch (err) {
return console.error(
`Error deleting subscription for user ${appApiKey.userId}, webhookId ${webhookId}, appName ${appName}`
`Error deleting subscription for user ${appApiKey.userId}, webhookId ${webhookId}, appId ${appId}`
);
}
}

View File

@ -26,7 +26,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
const deleteEventSubscription = await deleteSubscription({
appApiKey: validKey,
webhookId: id,
appName: "make",
appId: "make",
});
if (!deleteEventSubscription) {

View File

@ -26,7 +26,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
const deleteEventSubscription = await deleteSubscription({
appApiKey: validKey,
webhookId: id,
appName: "zapier",
appId: "zapier",
});
if (!deleteEventSubscription) {