- improved /items/ with support for pagination - improved helper functions for tooltips and popovers - removed console log residue from handleSidebarTriangles - introduction of version route
		
			
				
	
	
		
			23 lines
		
	
	
		
			854 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			854 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Request, Response } from 'express';
 | |
| import { prisma, __path, log } from '../../index.js';
 | |
| 
 | |
| async function get(req: Request, res: Response) {
 | |
| 	prisma.item
 | |
| 		.findMany({}) // 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, storeLocs: locations, categories: categories, contactInfo: contactInfo });
 | |
| 					})
 | |
| 				});
 | |
| 			});
 | |
| 		})
 | |
| 		.catch((err) => {
 | |
| 			log.db.error(err);
 | |
| 			res.status(500).render(__path + '/src/frontend/errors/dbError.eta.html', { error: err });
 | |
| 		});
 | |
| }
 | |
| 
 | |
| export default { get };
 |