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.

code improvements

Pedro Ladeirac89f638bcd03
diff --git a/apps/web/app/(ee)/api/customers/[id]/reattribute/route.ts b/apps/web/app/(ee)/api/customers/[id]/reattribute/route.ts
index 9e364b186e..f84a3d36c2 100644
--- a/apps/web/app/(ee)/api/customers/[id]/reattribute/route.ts
+++ b/apps/web/app/(ee)/api/customers/[id]/reattribute/route.ts
@@ -190,6 +190,18 @@ export const POST = withWorkspace(
newCustomerId,
});
+ const failedJobIds = workflow.results
+ .filter((result) => result.status === "failed")
+ .map((result) => result.id);
+
+ if (failedJobIds.length > 0) {
+ await prisma.job.deleteMany({
+ where: {
+ id: { in: failedJobIds },
+ },
+ });
+ }
+
throw new DubApiError({
code: "internal_server_error",
message: