From d8027fe24875713ff3b214ac9c47f7b4566abc5d Mon Sep 17 00:00:00 2001 From: Cao Hoang <65607230+cnhhoang850@users.noreply.github.com> Date: Tue, 31 Dec 2024 04:15:27 +0700 Subject: [PATCH] Fix duplicated data returned by Prisma query in team availability view (#18416) Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> --- .../viewer/availability/team/listTeamAvailability.handler.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts b/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts index 52d0a7413d8359..cb60f939abe4ed 100644 --- a/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts +++ b/packages/trpc/server/routers/viewer/availability/team/listTeamAvailability.handler.ts @@ -67,9 +67,7 @@ async function getTeamMembers({ }, cursor: cursor ? { id: cursor } : undefined, take: limit + 1, // We take +1 as itll be used for the next cursor - orderBy: { - id: "asc", - }, + orderBy: [{ userId: "asc" }, { id: "asc" }], // Prisma require a unique field for tie breaking duplicate value for pagination distinct: ["userId"], });