* start make app integration * setup integration * add relevant env vars * update app metadata * import setup route in app setups * fix typo * add app store imports * fix module import error * update make readme * move scheduler to app-store utils * move add subscription to node scheduler * move delete subscription to scheduler * subscribe unsubscribe in zapier using common nodeScheduler * fix lint errors * revert settings.json * update icon * add app screenshots * fix app description * fix type errors * update app code * Delete .gitkeep * delete unused template files * get app invite link from env vars * chore: handle error, cleanup readme, address review comments * fix: update link in readme * revert yarn.lock * fix type errors * Update packages/prisma/seed-app-store.ts * Update .env.appStore.example * Update .env.appStore.example * update app readme * fix param name in deleteSubcription * fix listBookings handler * Update turbo.json * use default installation handler to install app * use logger for console logs * Fix inviteLink reading * fix app setup handler * Fix type issue * always show app invite link * fix type error * add make invite link --------- Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import type { NextApiRequest, NextApiResponse } from "next";
|
|
import z from "zod";
|
|
|
|
import findValidApiKey from "@calcom/features/ee/api-keys/lib/findValidApiKey";
|
|
import { deleteSubscription } from "@calcom/features/webhooks/lib/scheduleTrigger";
|
|
import { defaultHandler, defaultResponder } from "@calcom/lib/server";
|
|
|
|
const querySchema = z.object({
|
|
apiKey: z.string(),
|
|
id: z.string(),
|
|
});
|
|
|
|
async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
const { apiKey, id } = querySchema.parse(req.query);
|
|
|
|
if (!apiKey) {
|
|
return res.status(401).json({ message: "No API key provided" });
|
|
}
|
|
|
|
const validKey = await findValidApiKey(apiKey, "make");
|
|
|
|
if (!validKey) {
|
|
return res.status(401).json({ message: "API key not valid" });
|
|
}
|
|
|
|
const deleteEventSubscription = await deleteSubscription({
|
|
appApiKey: validKey,
|
|
webhookId: id,
|
|
appId: "make",
|
|
});
|
|
|
|
if (!deleteEventSubscription) {
|
|
return res.status(500).json({ message: "Could not delete subscription." });
|
|
}
|
|
res.status(204).json({ message: "Subscription is deleted." });
|
|
}
|
|
|
|
export default defaultHandler({
|
|
DELETE: Promise.resolve({ default: defaultResponder(handler) }),
|
|
});
|