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 reactivate-program.ts

Kiran K763769cfd750
diff --git a/apps/web/lib/api/programs/reactivate-program.ts b/apps/web/lib/api/programs/reactivate-program.ts
index d39615301f..04247ea095 100644
--- a/apps/web/lib/api/programs/reactivate-program.ts
+++ b/apps/web/lib/api/programs/reactivate-program.ts
@@ -28,32 +28,37 @@ export async function reactivateProgram(
}
}
- await prisma.$transaction(
- programIds.flatMap((id) => [
+ for (const programId of programIds) {
+ const isProductionProgram = programId === workspace.defaultProgramId;
+
+ await prisma.$transaction([
prisma.program.update({
where: {
- id,
+ id: programId,
},
data: {
deactivatedAt: null,
},
}),
- // republish the default group
- prisma.partnerGroup.update({
- where: {
- programId_slug: {
- programId: id,
- slug: DEFAULT_PARTNER_GROUP.slug,
- },
- },
- data: {
- applicationFormPublishedAt: new Date(),
- landerPublishedAt: new Date(),
- },
- }),
- ]),
- );
+ ...(isProductionProgram
+ ? [
+ prisma.partnerGroup.update({
+ where: {
+ programId_slug: {
+ programId,
+ slug: DEFAULT_PARTNER_GROUP.slug,
+ },
+ },
+ data: {
+ applicationFormPublishedAt: new Date(),
+ landerPublishedAt: new Date(),
+ },
+ }),
+ ]
+ : []),
+ ]);
+ }
const responses = await Promise.all(
programIds.map((id) =>