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.

no decrement

Steven Tey4f44aa02d5ad
diff --git a/apps/web/lib/api/domains/delete-domain-links.ts b/apps/web/lib/api/domains/delete-domain-links.ts
index b7d1bf92fe..ef2fc1c2e4 100644
--- a/apps/web/lib/api/domains/delete-domain-links.ts
+++ b/apps/web/lib/api/domains/delete-domain-links.ts
@@ -127,17 +127,6 @@ export async function markDomainAsDeleted({
projectId: null,
},
}),
-
- prisma.project.update({
- where: {
- id: workspaceId,
- },
- data: {
- linksUsage: {
- decrement: links.count,
- },
- },
- }),
]);
await queueDomainDeletion({
diff --git a/apps/web/lib/api/links/bulk-delete-links.ts b/apps/web/lib/api/links/bulk-delete-links.ts
index ed0cee477e..140b5e7d4a 100644
--- a/apps/web/lib/api/links/bulk-delete-links.ts
+++ b/apps/web/lib/api/links/bulk-delete-links.ts
@@ -1,6 +1,5 @@
import { storage } from "@/lib/storage";
import { recordLink } from "@/lib/tinybird";
-import { prisma } from "@dub/prisma";
import { R2_URL } from "@dub/utils";
import { Link } from "@prisma/client";
import { linkCache } from "./cache";
@@ -39,17 +38,5 @@ export async function bulkDeleteLinks({
links
.filter((link) => link.image?.startsWith(`${R2_URL}/images/${link.id}`))
.map((link) => storage.delete(link.image!.replace(`${R2_URL}/`, ""))),
-
- // Decrement the links count for the workspace
- prisma.project.update({
- where: {
- id: workspaceId,
- },
- data: {
- linksUsage: {
- decrement: links.length,
- },
- },
- }),
]);
}
diff --git a/apps/web/lib/api/links/delete-link.ts b/apps/web/lib/api/links/delete-link.ts
index 810daedb1b..197ebef7a1 100644
--- a/apps/web/lib/api/links/delete-link.ts
+++ b/apps/web/lib/api/links/delete-link.ts
@@ -37,19 +37,6 @@ export async function deleteLink(linkId: string) {
created_at: link.createdAt,
deleted: true,
}),
-
- // Decrement the links count for the workspace
- link.projectId &&
- prisma.project.update({
- where: {
- id: link.projectId,
- },
- data: {
- linksUsage: {
- decrement: 1,
- },
- },
- }),
]),
);