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 update-subscribers.ts

Steven Tey1d906b15300f
diff --git a/apps/web/scripts/update-subscribers.ts b/apps/web/scripts/update-subscribers.ts
index b77b0be179..c1d69b4282 100644
--- a/apps/web/scripts/update-subscribers.ts
+++ b/apps/web/scripts/update-subscribers.ts
@@ -1,7 +1,5 @@
-import { RESEND_AUDIENCES } from "@dub/email/resend/constants";
import { prisma } from "@dub/prisma";
import "dotenv-flow/config";
-import { Resend } from "resend";
async function main() {
const partnerUsers = await prisma.user.findMany({
@@ -10,14 +8,13 @@ async function main() {
some: {},
},
projects: {
- none: {},
+ some: {},
},
},
orderBy: {
createdAt: "asc",
},
- skip: 100,
- take: 100,
+ skip: 200,
});
console.log(`Found ${partnerUsers.length} partner users`);
@@ -28,17 +25,6 @@ async function main() {
continue;
}
- await Promise.all([
- subscribe({
- email: user.email,
- name: user.name,
- audience: "partners.dub.co",
- }),
- unsubscribe({
- email: user.email,
- }),
- ]);
-
console.log(
`Subscribed ${user.email} to partners.dub.co and unsubscribed from app.dub.co`,
);
@@ -46,35 +32,3 @@ async function main() {
}
main();
-
-const resend = new Resend(process.env.RESEND_API_KEY);
-
-const subscribe = async ({
- email,
- name,
- audience,
-}: {
- email: string;
- name: string | null;
- audience: keyof typeof RESEND_AUDIENCES;
-}) => {
- const audienceId = RESEND_AUDIENCES[audience];
- return await resend.contacts.create({
- email,
- ...(name && {
- firstName: name.split(" ")[0],
- lastName: name.split(" ").slice(1).join(" "),
- }),
- audienceId,
- });
-};
-
-const unsubscribe = async ({ email }: { email: string }) => {
- // TODO: Update this to support partners.dub.co in the future
- const audienceId = RESEND_AUDIENCES["app.dub.co"];
-
- return await resend.contacts.remove({
- email,
- audienceId,
- });
-};