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 script

Steven Tey2cb612efbe3d
diff --git a/apps/web/scripts/get-premium-workspaces.ts b/apps/web/scripts/get-premium-workspaces.ts
new file mode 100644
index 0000000000..3559e6fda7
--- /dev/null
+++ b/apps/web/scripts/get-premium-workspaces.ts
@@ -0,0 +1,50 @@
+import { prisma } from "@/lib/prisma";
+import "dotenv-flow/config";
+import * as fs from "fs";
+import * as Papa from "papaparse";
+
+async function main() {
+ const workspaces = await prisma.project.findMany({
+ where: {
+ NOT: {
+ plan: "free",
+ },
+ slug: {
+ notIn: ["acme", "legal"],
+ },
+ domains: {
+ none: {
+ verified: true,
+ },
+ },
+ links: {
+ some: {
+ domain: "dub.sh",
+ createdAt: {
+ gt: new Date("2024-02-01"),
+ },
+ },
+ },
+ },
+ select: {
+ id: true,
+ slug: true,
+ },
+ orderBy: {
+ createdAt: "asc",
+ },
+ });
+
+ console.table(workspaces);
+ fs.writeFileSync(
+ "premium_workspaces.csv",
+ Papa.unparse(
+ workspaces.map((w) => ({
+ id: `ws_${w.id}`,
+ slug: w.slug,
+ })),
+ ),
+ );
+}
+
+main();