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.

increase bounties to top 50

Steven Tey1e3a9304c432
diff --git a/apps/web/scripts/partners/export-partners.ts b/apps/web/scripts/partners/export-partners.ts
index 30f066742d..eab66b8696 100644
--- a/apps/web/scripts/partners/export-partners.ts
+++ b/apps/web/scripts/partners/export-partners.ts
@@ -1,30 +1,86 @@
import { prisma } from "@/lib/prisma";
+import { PlatformType } from "@prisma/client";
import "dotenv-flow/config";
import * as fs from "fs";
import * as Papa from "papaparse";
-// export partners for a program
+const platformTypes = Object.values(PlatformType);
+
+// export partners approved or trusted in the Dub network
async function main() {
- const partners = await prisma.programEnrollment
- .findMany({
- where: {
- programId: "prog_xxx",
- status: "approved",
+ const partners = await prisma.partner.findMany({
+ where: {
+ networkStatus: {
+ in: ["approved", "trusted"],
},
- select: {
- partner: {
- select: {
- name: true,
- email: true,
- },
+ },
+ select: {
+ id: true,
+ name: true,
+ email: true,
+ description: true,
+ country: true,
+ companyName: true,
+ profileType: true,
+ networkStatus: true,
+ platforms: {
+ select: {
+ type: true,
+ identifier: true,
+ verifiedAt: true,
+ subscribers: true,
},
},
- })
- .then((partners) => partners.map(({ partner }) => partner));
+ },
+ });
+
+ const rows = partners.map(
+ ({
+ id,
+ name,
+ description,
+ country,
+ companyName,
+ profileType,
+ networkStatus,
+ platforms,
+ }) => {
+ const platformsByType = Object.fromEntries(
+ platforms.map((platform) => [platform.type, platform]),
+ );
+
+ return {
+ id,
+ name,
+ description,
+ country,
+ companyName,
+ profileType,
+ networkStatus,
+ ...Object.fromEntries(
+ platformTypes.flatMap((type) => {
+ const platform = platformsByType[type];
+ const followers = platform ? Number(platform.subscribers) : "";
+
+ return [
+ [type, platform?.identifier ?? ""],
+ [`${type}Verified`, Boolean(platform?.verifiedAt)],
+ [
+ type === "website"
+ ? "websiteDomainRanking"
+ : `${type}Followers`,
+ followers,
+ ],
+ ];
+ }),
+ ),
+ };
+ },
+ );
- console.log(`Exporting ${partners.length} partners`);
+ console.log(`Exporting ${rows.length} partners`);
- fs.writeFileSync("partners.csv", Papa.unparse(partners));
+ fs.writeFileSync("dub_network_partners.csv", Papa.unparse(rows));
}
main();
diff --git a/apps/web/ui/partners/bounties/partner-bounties-table.tsx b/apps/web/ui/partners/bounties/partner-bounties-table.tsx
index 831a0142d0..9e7ce33bd7 100644
--- a/apps/web/ui/partners/bounties/partner-bounties-table.tsx
+++ b/apps/web/ui/partners/bounties/partner-bounties-table.tsx
@@ -18,8 +18,6 @@ import {
} from "./bounty-performance";
import { BountyThumbnailImage } from "./bounty-thumbnail-image";
-const PAGE_SIZE = 10;
-
// the program is only set on the bounties of all programs
export type PartnerBountyRow = PartnerBountyProps & {
program?: Pick<ProgramProps, "name" | "logo">;
@@ -135,7 +133,7 @@ export function PartnerBountiesTable<T extends PartnerBountyRow>({
}>({ sortBy: "endsAt", sortOrder: "asc" });
const { pagination, setPagination } = useTablePagination({
- pageSize: PAGE_SIZE,
+ pageSize: 50,
page: 1,
});