Add custom items per page dropdowns

This commit is contained in:
headlessdev
2025-04-25 23:34:52 +02:00
parent d81d8c04ad
commit 677d1c5a58
6 changed files with 470 additions and 34 deletions

View File

@@ -4,6 +4,7 @@ import { prisma } from "@/lib/prisma";
interface RequestBody {
timespan?: number;
page?: number;
itemsPerPage?: number;
}
@@ -100,8 +101,7 @@ const getIntervalKey = (date: Date, timespan: number) => {
export async function POST(request: NextRequest) {
try {
const { timespan = 1, page = 1 }: RequestBody = await request.json();
const itemsPerPage = 5;
const { timespan = 1, page = 1, itemsPerPage = 5 }: RequestBody = await request.json();
const skip = (page - 1) * itemsPerPage;
// Get paginated and sorted applications