implemented connectedDispatch record for dispatcher
This commit is contained in:
22
apps/dispatch-server/routes/status.ts
Normal file
22
apps/dispatch-server/routes/status.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { prisma } from "@repo/db";
|
||||
import { Router } from "express";
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get("/connected-users", async (req, res) => {
|
||||
const connectedDispatcher = await prisma.connectedDispatcher.findMany({
|
||||
where: {
|
||||
logoutTime: null,
|
||||
},
|
||||
});
|
||||
|
||||
const connectedAircraft = await prisma.connectedAircraft.findMany({
|
||||
where: {
|
||||
logoutTime: null,
|
||||
},
|
||||
});
|
||||
|
||||
res.json([...connectedDispatcher, ...connectedAircraft]);
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user