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.

Fix e2e cleanup cron: use deleteDiscountCodes for Stripe cleanup

Kiran K378950815c52
diff --git a/apps/web/app/(ee)/api/cron/cleanup/e2e-tests/route.ts b/apps/web/app/(ee)/api/cron/cleanup/e2e-tests/route.ts
index 4e5d6528ee..86d54e14a5 100644
--- a/apps/web/app/(ee)/api/cron/cleanup/e2e-tests/route.ts
+++ b/apps/web/app/(ee)/api/cron/cleanup/e2e-tests/route.ts
@@ -1,3 +1,4 @@
+import { deleteDiscountCodes } from "@/lib/api/discounts/delete-discount-code";
import { markDomainAsDeleted } from "@/lib/api/domains/mark-domain-deleted";
import { handleAndReturnErrorResponse } from "@/lib/api/errors";
import { bulkDeleteLinks } from "@/lib/api/links/bulk-delete-links";
@@ -39,6 +40,7 @@ export async function POST(req: Request) {
include: {
...includeTags,
...includeProgramEnrollment,
+ discountCode: true,
},
take: 100,
}),
@@ -96,8 +98,9 @@ export async function POST(req: Request) {
}),
]);
- // Delete the links
if (links.length > 0) {
+ await deleteDiscountCodes(links.flatMap((link) => link.discountCode));
+
await prisma.link.deleteMany({
where: {
id: {