The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix sorting
Kiran K5269630a41b7
diff --git a/apps/web/lib/api/bounties/get-bounty-submissions.ts b/apps/web/lib/api/bounties/get-bounty-submissions.tsindex b0b3901224..e6449af303 100644--- a/apps/web/lib/api/bounties/get-bounty-submissions.ts+++ b/apps/web/lib/api/bounties/get-bounty-submissions.ts@@ -1,15 +1,28 @@import { BountySubmissionsQueryFilters } from "@/lib/types";+import { BOUNTY_SUBMISSIONS_SORT_BY_COLUMNS } from "@/lib/zod/schemas/bounties";import { prisma } from "@dub/prisma";interface GetBountySubmissionsParams extends BountySubmissionsQueryFilters {bountyId: string;}+const SORT_COLUMNS_MAP: Record<+ (typeof BOUNTY_SUBMISSIONS_SORT_BY_COLUMNS)[number],+ string+> = {+ createdAt: "createdAt",+ commissions: "count",+ leads: "count",+ conversions: "count",+ saleAmount: "count",+};+// Get list of submissions for a given bountyexport async function getBountySubmissions({bountyId,groupId,sortOrder,+ sortBy,page,pageSize,status,@@ -31,7 +44,7 @@ export async function getBountySubmissions({programEnrollment: true,},orderBy: {- createdAt: sortOrder, // TODO: We need to fix the sorting+ [SORT_COLUMNS_MAP[sortBy]]: sortOrder,},skip: (page - 1) * pageSize,take: pageSize,