clean code
parent
831c85dfef
commit
86cbdb2664
|
@ -1,6 +1,8 @@
|
||||||
import { ApiKeyType } from "@prisma/client";
|
import { ApiKeyType } from "@prisma/client";
|
||||||
import type { NextApiRequest, NextApiResponse } from "next";
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
|
||||||
|
import _metadata from "@calcom/app-store/zapierother/_metadata";
|
||||||
|
|
||||||
import { getSession } from "@lib/auth";
|
import { getSession } from "@lib/auth";
|
||||||
import prisma from "@lib/prisma";
|
import prisma from "@lib/prisma";
|
||||||
|
|
||||||
|
@ -52,8 +54,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (integration?.type === "zapier_other") {
|
if (integration?.type === _metadata.type) {
|
||||||
const keyToDelete = await prisma.apiKey.findFirst({
|
const apiKeyToDelete = await prisma.apiKey.findFirst({
|
||||||
where: {
|
where: {
|
||||||
userId: session?.user?.id,
|
userId: session?.user?.id,
|
||||||
apiKeyType: ApiKeyType.ZAPIER,
|
apiKeyType: ApiKeyType.ZAPIER,
|
||||||
|
@ -62,7 +64,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
|
|
||||||
await prisma.apiKey.delete({
|
await prisma.apiKey.delete({
|
||||||
where: {
|
where: {
|
||||||
id: keyToDelete?.id,
|
id: apiKeyToDelete?.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue