fix param name in deleteSubcription
parent
d4bb915cc8
commit
c4bfe98798
|
@ -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}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue