dashpresshq/dashpress

View on GitHub
src/backend/data/utils.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import type { PaginatedData } from "@/shared/types/data";

import type { IPaginationFilters } from "./types";

export const makeTableData = (
  [data, totalRecords]: [Record<string, unknown>[], number],
  paginationFilters: IPaginationFilters
): PaginatedData<Record<string, unknown>> => ({
  data,
  pageIndex: paginationFilters.page,
  pageSize: paginationFilters.take,
  totalRecords,
});