Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

incorrect service pagination #12

Open
AtmegaBuzz opened this issue Oct 26, 2024 · 0 comments
Open

incorrect service pagination #12

AtmegaBuzz opened this issue Oct 26, 2024 · 0 comments

Comments

@AtmegaBuzz
Copy link

Pagination starts from number 0 but the limit in swagger is 1, so we can never view page 0 or the first page in all the query service functions.

it should be like

const users = await prisma.user.findMany({
    where: filter,
    select: keys.reduce((obj, k) => ({ ...obj, [k]: true }), {}),
    skip: (page - 1) * limit,
    take: limit,
    orderBy: sortBy ? { [sortBy]: sortType } : undefined
  });

here i've changed skip: (page -1) to make pagination aligned from the user entered pagination.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant