From 93d9f2f1321b7f8456e889d5b9c41d68d1f9f12f Mon Sep 17 00:00:00 2001 From: Douglas Barone Date: Thu, 29 Jun 2023 15:53:18 -0400 Subject: [PATCH] Join RT --- src/controllers/PrinterController.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/controllers/PrinterController.ts b/src/controllers/PrinterController.ts index d726456..b920a10 100644 --- a/src/controllers/PrinterController.ts +++ b/src/controllers/PrinterController.ts @@ -11,6 +11,23 @@ class PrinterController { static async index(req: Request, res: Response) { const { campus } = req.query + if (campus == 'RT') { + const printers = await prisma.printer.findMany({ + where: { + network: { OR: [{ shortName: 'RT1' }, { shortName: 'RT2' }] } + }, + include: { + network: true, + status: { + orderBy: { timestamp: 'desc' }, + take: 1 + } + }, + orderBy: { network: { cidr: 'asc' } } + }) + return res.json(printers) + } + if (!campus) { const printers = await prisma.printer.findMany({ include: {