From fa10f4d7d40da758b90fefdd8fa47d1315a12db1 Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Wed, 21 May 2025 09:21:25 -0700 Subject: [PATCH] dev --- apps/dispatch-server/routes/mission.ts | 11 +++++++---- .../_components/pannel/MissionForm.tsx | 13 +------------ grafana/grafana.db | Bin 1122304 -> 1122304 bytes 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/apps/dispatch-server/routes/mission.ts b/apps/dispatch-server/routes/mission.ts index 3775b449..f1599890 100644 --- a/apps/dispatch-server/routes/mission.ts +++ b/apps/dispatch-server/routes/mission.ts @@ -122,11 +122,15 @@ router.post("/:id/send-alert", async (req, res) => { res.status(404).json({ error: "Mission not found" }); return; } + + // connectedAircrafts the alert is sent to const connectedAircrafts = await prisma.connectedAircraft.findMany({ where: { - stationId: { - in: mission.missionStationIds, - }, + stationId: stationId + ? stationId + : { + in: mission.missionStationIds, + }, logoutTime: null, }, include: { @@ -135,7 +139,6 @@ router.post("/:id/send-alert", async (req, res) => { }); for (const aircraft of connectedAircrafts) { - if (stationId && stationId !== aircraft.stationId) continue; console.log(`Sending mission to: station:${aircraft.stationId}`); io.to(`station:${aircraft.stationId}`).emit("mission-alert", { ...mission, diff --git a/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx b/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx index a1edd61c..6ec9ed21 100644 --- a/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx +++ b/apps/dispatch/app/dispatch/_components/pannel/MissionForm.tsx @@ -47,17 +47,6 @@ export const MissionForm = () => { }); }, }); - const sendAlertMutation = useMutation({ - mutationKey: ["missions"], - mutationFn: (id: number) => sendMissionAPI(id, {}), - onError: (error) => { - console.error(error); - toast.error("Fehler beim Alarmieren"); - }, - onSuccess: (data) => { - toast.success(data.message); - }, - }); const editMissionMutation = useMutation({ mutationFn: ({ @@ -77,7 +66,7 @@ export const MissionForm = () => { const sendAlertMutation = useMutation({ mutationKey: ["missions"], - mutationFn: sendMissionAPI, + mutationFn: (id: number) => sendMissionAPI(id, {}), onError: (error) => { console.error(error); toast.error("Fehler beim Alarmieren"); diff --git a/grafana/grafana.db b/grafana/grafana.db index 7d13ed8a8543739e7db812d4b3fddcb294b50780..6435de4eb5f886b0f81a97444ab5d305f917d2cb 100644 GIT binary patch delta 87 zcmZoT;L>owWr8%L+e8^>Mz_X<)&$1Z1g6#m=GFw3)&$np1h&=$_N@sVrTVNj8M=S7 g+HdJ|05K;Ja{)0o5c2>rFA(zqG5_{k`T}Yn09EfGasU7T delta 87 zcmZoT;L>owWr8%L>qHr6M%TuK)&$1Z1g6#m=GFw3)&$np1h&=$_N@sVrTVPZ8M?oP g+HdJ|05K;Ja{)0o5c2>rFA(zqG5_{k`T}Yn07rEo6#xJL