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 backfill-application-groupId.ts

Kiran K66f3513cfd75
diff --git a/apps/web/scripts/partners/backfill-application-groupId.ts b/apps/web/scripts/partners/backfill-application-groupId.ts
index a299b8275d..85594b0ca3 100644
--- a/apps/web/scripts/partners/backfill-application-groupId.ts
+++ b/apps/web/scripts/partners/backfill-application-groupId.ts
@@ -8,6 +8,7 @@ async function main() {
id: true,
defaultGroupId: true,
},
+ take: 100,
});
console.table(programs);
@@ -32,21 +33,23 @@ async function main() {
programs.map(({ id, defaultGroupId }) => [id, defaultGroupId]),
);
- for (const { id, programId } of programApplications) {
- if (!programMap.has(programId)) {
- console.error(`defaultGroupId not found for ${programId}.`);
- continue;
- }
-
- await prisma.programApplication.update({
- where: {
- id,
- },
- data: {
- groupId: programMap.get(programId),
- },
- });
- }
+ await Promise.allSettled(
+ programApplications.map(({ id, programId }) => {
+ if (!programMap.has(programId)) {
+ console.error(`defaultGroupId not found for ${programId}.`);
+ return;
+ }
+
+ return prisma.programApplication.update({
+ where: {
+ id,
+ },
+ data: {
+ groupId: programMap.get(programId),
+ },
+ });
+ }),
+ );
}
main();