Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

optimize the args

Kiran Kaa9464b28f0b
diff --git a/apps/web/app/api/oauth-apps/[clientId]/disconnect/route.ts b/apps/web/app/api/oauth-apps/[clientId]/disconnect/route.ts
index 3051288087..d211db6de7 100644
--- a/apps/web/app/api/oauth-apps/[clientId]/disconnect/route.ts
+++ b/apps/web/app/api/oauth-apps/[clientId]/disconnect/route.ts
@@ -5,29 +5,21 @@ import { NextResponse } from "next/server";
// DELETE /api/oauth-apps/[clientId]/disconnect - Disconnect an authorized OAuth app from the workspace
export const DELETE = withWorkspace(
async ({ params, workspace, session }) => {
- const { clientId } = params;
- const { id: userId } = session.user;
- const { id: projectId } = workspace;
+ const prismaArgs = {
+ userId_projectId_clientId: {
+ userId: session.user.id,
+ projectId: workspace.id,
+ clientId: params.clientId,
+ },
+ };
await prisma.$transaction([
prisma.oAuthAuthorizedApp.delete({
- where: {
- userId_projectId_clientId: {
- userId,
- projectId,
- clientId,
- },
- },
+ where: prismaArgs,
}),
prisma.restrictedToken.delete({
- where: {
- userId_projectId_clientId: {
- userId,
- projectId,
- clientId,
- },
- },
+ where: prismaArgs,
}),
]);