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.

bio → description first half

Steven Teye07f8c17fc03
diff --git a/apps/web/app/api/partners/[partnerId]/route.ts b/apps/web/app/api/partners/[partnerId]/route.ts
index f1be55cc3e..5fb2c8d906 100644
--- a/apps/web/app/api/partners/[partnerId]/route.ts
+++ b/apps/web/app/api/partners/[partnerId]/route.ts
@@ -76,6 +76,7 @@ export const GET = withWorkspace(
...programEnrollment.partner,
...programEnrollment,
id: programEnrollment.partnerId,
+ description: programEnrollment.partner.bio ?? null, // TODO: Remove after bio->description migration
clicks: totalClicks,
leads: totalLeads,
sales: totalSales,
diff --git a/apps/web/app/api/partners/route.ts b/apps/web/app/api/partners/route.ts
index 4822ce082f..dad738cc8c 100644
--- a/apps/web/app/api/partners/route.ts
+++ b/apps/web/app/api/partners/route.ts
@@ -56,7 +56,7 @@ export const GET = withWorkspace(
earnings: "totalSaleAmount",
};
- const partners = await prisma.$queryRaw`
+ const partners = (await prisma.$queryRaw`
SELECT
p.*,
pe.id as enrollmentId,
@@ -102,11 +102,11 @@ export const GET = withWorkspace(
GROUP BY
p.id, pe.id
ORDER BY ${Prisma.raw(sortColumnsMap[sortBy])} ${Prisma.raw(sortOrder)}
- LIMIT ${pageSize} OFFSET ${(page - 1) * pageSize}`;
+ LIMIT ${pageSize} OFFSET ${(page - 1) * pageSize}`) satisfies Array<any>;
- // @ts-ignore
const response = partners.map((partner) => ({
...partner,
+ description: partner.bio ?? null, // TODO: Remove after bio->description migration
createdAt: new Date(partner.enrollmentCreatedAt),
payoutsEnabled: Boolean(partner.payoutsEnabled),
clicks: Number(partner.totalClicks),
diff --git a/apps/web/lib/api/partners/enroll-partner.ts b/apps/web/lib/api/partners/enroll-partner.ts
index 5544d72b31..663d2f7c6a 100644
--- a/apps/web/lib/api/partners/enroll-partner.ts
+++ b/apps/web/lib/api/partners/enroll-partner.ts
@@ -106,6 +106,7 @@ export const enrollPartner = async ({
...upsertedPartner,
...upsertedPartner.programs[0],
id: upsertedPartner.id,
+ description: upsertedPartner.bio, // TODO: Remove after bio->description migration
links: [link],
});
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index d6059e564c..7cb793d3eb 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -54,7 +54,7 @@ export const PartnerSchema = z.object({
email: z.string().nullable(),
image: z.string().nullable(),
country: z.string(),
- bio: z.string().nullable(),
+ description: z.string().nullable(),
status: z.nativeEnum(PartnerStatus),
stripeConnectId: z.string().nullable(),
couponId: z.string().nullish(),
@@ -69,7 +69,7 @@ export const EnrolledPartnerSchema = PartnerSchema.pick({
name: true,
email: true,
image: true,
- bio: true,
+ description: true,
country: true,
createdAt: true,
})
diff --git a/apps/web/scripts/delete-partners.ts b/apps/web/scripts/delete-partners.ts
index 21a07acfcb..04175d5906 100644
--- a/apps/web/scripts/delete-partners.ts
+++ b/apps/web/scripts/delete-partners.ts
@@ -5,7 +5,7 @@ import { bulkDeleteLinks } from "../lib/api/links/bulk-delete-links";
async function main() {
const partner = await prisma.partner.findUniqueOrThrow({
where: {
- id: "pn_IPuZmH1ZtKGGisITTVsxAQHA",
+ id: "pn_ut9bjqXAHTsMq7WzFAW6v4TU",
},
include: {
programs: {
diff --git a/apps/web/ui/partners/partner-details-sheet.tsx b/apps/web/ui/partners/partner-details-sheet.tsx
index 1f5289d030..17b6c60c40 100644
--- a/apps/web/ui/partners/partner-details-sheet.tsx
+++ b/apps/web/ui/partners/partner-details-sheet.tsx
@@ -215,7 +215,7 @@ function PartnerDetailsSheetContent({
<div>
<h4 className="font-semibold text-neutral-900">Description</h4>
<p className="mt-1.5">
- {partner.bio || (
+ {partner.description || (
<span className="italic text-neutral-400">
No description provided
</span>