import { prisma } from "@repo/db";
import { Router } from "express";

const router: 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;
