fix param name in deleteSubcription

integromat-app^2
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({ export async function deleteSubscription({
appApiKey, appApiKey,
webhookId, webhookId,
appName, appId,
}: { }: {
appApiKey: ApiKey; appApiKey: ApiKey;
webhookId: string; webhookId: string;
appName: string; appId: string;
}) { }) {
try { try {
const webhook = await prisma.webhook.findFirst({ const webhook = await prisma.webhook.findFirst({
@ -94,7 +94,7 @@ export async function deleteSubscription({
}); });
for (const booking of bookingsWithScheduledJobs) { for (const booking of bookingsWithScheduledJobs) {
const updatedScheduledJobs = booking.scheduledJobs.filter( const updatedScheduledJobs = booking.scheduledJobs.filter(
(scheduledJob) => scheduledJob !== `${appName}_${webhook.id}` (scheduledJob) => scheduledJob !== `${appId}_${webhook.id}`
); );
await prisma.booking.update({ await prisma.booking.update({
where: { where: {
@ -118,7 +118,7 @@ export async function deleteSubscription({
return deleteWebhook; return deleteWebhook;
} catch (err) { } catch (err) {
return console.error( 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({ const deleteEventSubscription = await deleteSubscription({
appApiKey: validKey, appApiKey: validKey,
webhookId: id, webhookId: id,
appName: "make", appId: "make",
}); });
if (!deleteEventSubscription) { if (!deleteEventSubscription) {

View File

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