From 9e8aa9667cce50d3fb61d81f3868ce3586262169 Mon Sep 17 00:00:00 2001 From: Douglas Barone Date: Thu, 29 Jun 2023 12:27:18 -0400 Subject: [PATCH] Include last status --- src/controllers/PrinterController.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/PrinterController.ts b/src/controllers/PrinterController.ts index 8ef9b6d..5d1f439 100644 --- a/src/controllers/PrinterController.ts +++ b/src/controllers/PrinterController.ts @@ -13,7 +13,13 @@ class PrinterController { if (!campus) { const printers = await prisma.printer.findMany({ - include: { network: true } + include: { + network: true, + status: { + orderBy: { timestamp: 'desc' }, + take: 1 + } + } }) return res.json(printers) }