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 K073c64d243e9
diff --git a/apps/web/app/(ee)/api/cron/links/create-promotion-codes/route.ts b/apps/web/app/(ee)/api/cron/links/create-promotion-codes/route.ts
index 6528f3f744..3ef8c1f4a4 100644
--- a/apps/web/app/(ee)/api/cron/links/create-promotion-codes/route.ts
+++ b/apps/web/app/(ee)/api/cron/links/create-promotion-codes/route.ts
@@ -30,7 +30,7 @@ export async function POST(req: Request) {
const {
couponId,
programId,
- program: { couponCodeTrackingEnabledAt },
+ program: { couponCodeTrackingEnabledAt, workspace },
} = await prisma.discount.findUniqueOrThrow({
where: {
id: discountId,
@@ -41,6 +41,11 @@ export async function POST(req: Request) {
program: {
select: {
couponCodeTrackingEnabledAt: true,
+ workspace: {
+ select: {
+ stripeConnectId: true,
+ },
+ },
},
},
},
@@ -58,19 +63,6 @@ export async function POST(req: Request) {
);
}
- const workspace = await prisma.project.findUniqueOrThrow({
- where: {
- defaultProgramId: programId,
- },
- select: {
- stripeConnectId: true,
- },
- });
-
- if (!workspace.stripeConnectId) {
- return new Response("stripeConnectId doesn't exist for the workspace.");
- }
-
let hasMore = true;
let currentPage = page;
let processedBatches = 0;