feat: Implement connected user API and integrate chat and report components

- Added API routes for fetching connected users, keywords, missions, and stations.
- Created a new QueryProvider component for managing query states and socket events.
- Introduced connection stores for dispatch and pilot, managing socket connections and states.
- Updated Prisma schema for connected aircraft model.
- Enhanced UI with toast notifications for status updates and chat interactions.
- Implemented query functions for fetching connected users and keywords with error handling.
This commit is contained in:
PxlLoewe
2025-05-07 00:43:45 -07:00
parent 152b3d4689
commit 50f42e99d3
49 changed files with 1040 additions and 701 deletions

View File

@@ -1,5 +1,6 @@
import { prisma } from "@repo/db";
import { Router } from "express";
import { io } from "../index";
const router = Router();
@@ -41,6 +42,7 @@ router.put("/", async (req, res) => {
const newMission = await prisma.mission.create({
data: req.body,
});
io.to("missions").emit("new-mission", newMission);
res.status(201).json(newMission);
} catch (error) {
res.status(500).json({ error: "Failed to create mission" });
@@ -55,6 +57,7 @@ router.patch("/:id", async (req, res) => {
where: { id: Number(id) },
data: req.body,
});
io.to("missions").emit("update-mission", updatedMission);
res.json(updatedMission);
} catch (error) {
console.error(error);
@@ -69,6 +72,7 @@ router.delete("/:id", async (req, res) => {
await prisma.mission.delete({
where: { id: Number(id) },
});
io.to("missions").emit("delete-mission", id);
res.status(204).send();
} catch (error) {
console.error(error);