From 185d563ac00914c4010d9d4977943dd81f46e589 Mon Sep 17 00:00:00 2001 From: grey Date: Fri, 7 Jul 2023 15:11:33 +0200 Subject: [PATCH] - sort item page by SKU --- src/routes/frontend/items.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/routes/frontend/items.ts b/src/routes/frontend/items.ts index 55e23af..b996adf 100644 --- a/src/routes/frontend/items.ts +++ b/src/routes/frontend/items.ts @@ -23,12 +23,11 @@ async function get(req: Request, res: Response) { return; } prisma.item - .findMany({ skip: (page - 1) * takeSize, take: takeSize }) // Skip the amount of items per page times the page number minus 1; skip has to be (page-1)*takeSize because skip is 0 indexed + .findMany({ skip: (page - 1) * takeSize, take: takeSize, orderBy: { SKU: "asc" } }) // Skip the amount of items per page times the page number minus 1; skip has to be (page-1)*takeSize because skip is 0 indexed .then((items) => { prisma.storageLocation.findMany({}).then((locations) => { prisma.itemCategory.findMany({}).then((categories) => { prisma.contactInfo.findMany({}).then((contactInfo) => { - res.render(__path + '/src/frontend/items.eta.html', { items: items, currentPage: page, maxPages: pageSize, storeLocs: locations, categories: categories, contactInfo: contactInfo }); }) });