Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Use take in Prisma
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Aug 28, 2020
1 parent d598a1f commit 9558c36
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/_staart/helpers/prisma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,9 @@ export const queryParamsToSelect = (queryParams: any) => {
return data;
};

export const paginatedResult = <T>(
data: T,
{ first, last }: { first?: number; last?: number }
) => {
export const paginatedResult = <T>(data: T, { take }: { take?: number }) => {
const dataArray = (data as any) as { id: number }[];
const hasMore = dataArray.length >= (first || last || Infinity);
const hasMore = dataArray.length >= (take || Infinity);
return {
data,
hasMore,
Expand Down

0 comments on commit 9558c36

Please sign in to comment.