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.

Update route.ts

Kiran Ke221bc698068
diff --git a/apps/web/app/api/folders/[folderId]/route.ts b/apps/web/app/api/folders/[folderId]/route.ts
index 30ad07555b..2cd14bc6f5 100644
--- a/apps/web/app/api/folders/[folderId]/route.ts
+++ b/apps/web/app/api/folders/[folderId]/route.ts
@@ -141,6 +141,7 @@ export const DELETE = withWorkspace(
projectId: "",
},
}),
+
queueFolderDeletion({
folderId,
}),
@@ -148,16 +149,27 @@ export const DELETE = withWorkspace(
}
waitUntil(
- prisma.project.update({
- where: {
- id: workspace.id,
- },
- data: {
- foldersUsage: {
- decrement: 1,
+ Promise.allSettled([
+ prisma.project.update({
+ where: {
+ id: workspace.id,
},
- },
- }),
+ data: {
+ foldersUsage: {
+ decrement: 1,
+ },
+ },
+ }),
+
+ prisma.projectUsers.updateMany({
+ where: {
+ defaultFolderId: folderId,
+ },
+ data: {
+ defaultFolderId: null,
+ },
+ }),
+ ]),
);
return NextResponse.json({ id: folderId });