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.

stash

Steven Tey1b9a46f6ff26
diff --git a/apps/web/lib/jobs/index.ts b/apps/web/lib/jobs/index.ts
index 4e1afd59d5..1e9e5752d2 100644
--- a/apps/web/lib/jobs/index.ts
+++ b/apps/web/lib/jobs/index.ts
@@ -2,7 +2,7 @@ import { createId } from "@/lib/api/create-id";
import { logger } from "@/lib/axiom/server";
import { qstash } from "@/lib/cron";
import { prisma } from "@/lib/prisma";
-import { APP_DOMAIN_WITH_NGROK, chunk } from "@dub/utils";
+import { chunk } from "@dub/utils";
import { Prisma } from "@prisma/client";
import { PublishRequest } from "@upstash/qstash";
import * as z from "zod/v4";
@@ -51,7 +51,7 @@ type JobReplayOptions = Pick<
"deduplicationId" | "retries" | "queue" | "flowControl" | "label"
>;
-const JOBS_ENDPOINT_URL = `${APP_DOMAIN_WITH_NGROK}/api/jobs/process`;
+const JOBS_ENDPOINT_URL = `https://app.dub.co/api/jobs/process`;
const QSTASH_PUBLISH_MAX_RETRIES = 3;
diff --git a/apps/web/scripts/bulk-delete-users.ts b/apps/web/scripts/bulk-delete-users.ts
new file mode 100644
index 0000000000..c828c1f29b
--- /dev/null
+++ b/apps/web/scripts/bulk-delete-users.ts
@@ -0,0 +1,55 @@
+import { prisma } from "@/lib/prisma";
+import "dotenv-flow/config";
+
+const USER_IDS = [
+ "user_1KWJA9VBJAWHRYTBMNXKBSEV6",
+ "user_1KWGF6ASW9ARS3PRWC7VQWCJP",
+ "user_1KWGF56D4RKHJ4J3T74T1GJBB",
+ "user_1KWG3B6WXB20Z820ZQ740CVN9",
+ "user_1KWG3DDGFQRQ6315YH263Q01H",
+ "user_1KWFQ65M4NCE4TBA7DHHPV9FA",
+ "user_1KWAYN607SX8ZY0EHAEHZH8CZ",
+ "user_1KWAYK2WQ08H44Z89AV5D0142",
+ "user_1KWAYHZCAJJAF3BASR9M8J73B",
+ "user_1KWAYGG4HQ1YCRCTDXD43961W",
+ "user_1KWAYF2EXQ32FCQ245FQWJ3KE",
+ "user_1KWAYE11PN191CW7W2GCA7WGW",
+ "user_1KWAYBXHGAK891JC0EZEK4K6V",
+ "user_1KTSRRXPTB7NRECH0QAQX8DMK",
+ "user_1KTSEGRBAC8Z3PZJMRQ7BQEF8",
+ "user_1KTS2VTNNHMBWTSXPQ1SH1SZ8",
+];
+
+async function main() {
+ let deleted = 0;
+ let failed = 0;
+
+ // const projectUsers = await prisma.projectUsers.findMany({
+ // where: {
+ // userId: {
+ // in: USER_IDS,
+ // },
+ // },
+ // });
+
+ // console.log(`Found ${projectUsers.length} project users.`);
+ // console.log(projectUsers);
+
+ for (const userId of USER_IDS) {
+ try {
+ const user = await prisma.user.delete({
+ where: { id: userId },
+ select: { id: true, email: true },
+ });
+ console.log(`Deleted user ${user.email} (${user.id})`);
+ deleted++;
+ } catch (error) {
+ console.error(`Failed to delete user ${userId}:`, error);
+ failed++;
+ }
+ }
+
+ console.log(`Done. Deleted ${deleted} users, ${failed} failed.`);
+}
+
+main();
diff --git a/apps/web/scripts/find-link.ts b/apps/web/scripts/find-link.ts
index ef8d4ea117..9187e77557 100644
--- a/apps/web/scripts/find-link.ts
+++ b/apps/web/scripts/find-link.ts
@@ -2,19 +2,40 @@ import { prisma } from "@/lib/prisma";
import "dotenv-flow/config";
async function main() {
- const links = await prisma.link.findMany({
+ const subdomains = await prisma.domain.findMany({
where: {
- projectId: "xxx",
- url: "https://example.com",
+ slug: {
+ endsWith: ".dub.link",
+ },
+ project: {
+ defaultProgramId: null,
+ plan: "free",
+ },
+ links: {
+ every: {
+ key: "_root",
+ },
+ },
},
- select: {
- id: true,
- shortLink: true,
- url: true,
+ include: {
+ project: true,
},
});
+ console.log(`Found ${subdomains.length} subdomains.`);
+ console.table(
+ subdomains.map((subdomain) => ({
+ slug: subdomain.slug,
+ project: subdomain.project?.slug,
+ plan: subdomain.project?.plan,
+ hasStore: !!subdomain.project?.store,
+ })),
+ );
- console.table(links);
+ // for (const subdomain of subdomains) {
+ // await markDomainAsDeleted({
+ // domain: subdomain.slug,
+ // });
+ // }
}
main();