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 route.ts

Kiran Kb0e3e289ed0a
diff --git a/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts b/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts
index e6932d82b6..bf20268c79 100644
--- a/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts
+++ b/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts
@@ -30,6 +30,13 @@ interface Earnings {
earnings: number;
}
+const eventMap = {
+ clicks: "click",
+ leads: "lead",
+ sales: "sale",
+ composite: "click, lead, sale",
+};
+
// GET /api/partner-profile/programs/[programId]/earnings/timeseries - get timeseries chart for a partner's earnings
export const GET = withPartnerProfile(
async ({ partner, params, searchParams }) => {
@@ -48,13 +55,6 @@ export const GET = withPartnerProfile(
});
if (groupBy === "count") {
- const eventMap = {
- clicks: "click",
- leads: "lead",
- sales: "sale",
- composite: "click, lead, sale",
- };
-
const earnings = await prisma.$queryRaw<EarningsResult>`
SELECT
COUNT(CASE WHEN type = 'click' THEN 1 END) AS clicks,