Converted reports and share routes.

This commit is contained in:
Mike Cao 2025-01-28 10:21:56 -08:00
parent dcac7b7c96
commit 6c9f1ad06b
23 changed files with 574 additions and 5 deletions

View file

@ -243,7 +243,7 @@ async function pagedQuery<T>(model: string, criteria: T, pageParams: PageParams)
const data = await prisma.client[model].findMany({
...criteria,
...{
...(size > 0 && { take: +size, skip: +size * (page - 1) }),
...(size > 0 && { take: +size, skip: +size * (+page - 1) }),
...(orderBy && {
orderBy: [
{
@ -266,7 +266,7 @@ async function pagedRawQuery(
) {
const { page = 1, pageSize, orderBy, sortDescending = false } = pageParams;
const size = +pageSize || DEFAULT_PAGE_SIZE;
const offset = +size * (page - 1);
const offset = +size * (+page - 1);
const direction = sortDescending ? 'desc' : 'asc';
const statements = [