From a2c320ddbe0d884005cad39799532dc7f87f7921 Mon Sep 17 00:00:00 2001 From: PxlLoewe <72106766+PxlLoewe@users.noreply.github.com> Date: Sat, 4 Oct 2025 21:16:24 +0200 Subject: [PATCH] XPlane Plugin anzeige auf tracker --- .../map/_components/AircraftMarkerTabs.tsx | 6 ++++ apps/dispatch/app/api/position-log/route.ts | 4 ++- .../prisma/schema/connectedAircraft.prisma | 33 ++++++++++--------- .../migration.sql | 2 ++ 4 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 packages/database/prisma/schema/migrations/20251004191000_add_xplane_plugin_parameter/migration.sql diff --git a/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx b/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx index 94484eb2..97e529ab 100644 --- a/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx +++ b/apps/dispatch/app/_components/map/_components/AircraftMarkerTabs.tsx @@ -296,6 +296,12 @@ const StationTab = ({ aircraft }: { aircraft: ConnectedAircraft & { Station: Sta {aircraft.posH145active ? "H145 Aktiv" : "H145 Inaktiv"} + + {" "} + + {aircraft.posXplanePluginActive ? "X-Plane Plugin Aktiv" : "X-Plane Plugin Inaktiv"} + + ); diff --git a/apps/dispatch/app/api/position-log/route.ts b/apps/dispatch/app/api/position-log/route.ts index 87891c70..dddd0d58 100644 --- a/apps/dispatch/app/api/position-log/route.ts +++ b/apps/dispatch/app/api/position-log/route.ts @@ -21,9 +21,10 @@ export const PUT = async (req: Request) => { if (!session && !payload) return Response.json({ message: "Unauthorized" }, { status: 401 }); const userId = session?.user.id || payload.id; - const { position, h145 } = (await req.json()) as { + const { position, h145, xPlanePluginActive } = (await req.json()) as { position: PositionLog; h145: boolean; + xPlanePluginActive: boolean; }; if (!position) { return Response.json({ message: "Missing id or position" }); @@ -61,6 +62,7 @@ export const PUT = async (req: Request) => { posHeading: position.heading, posSpeed: position.speed, posH145active: h145, + posXplanePluginActive: xPlanePluginActive, }, }); diff --git a/packages/database/prisma/schema/connectedAircraft.prisma b/packages/database/prisma/schema/connectedAircraft.prisma index 19e3d239..b1de5432 100644 --- a/packages/database/prisma/schema/connectedAircraft.prisma +++ b/packages/database/prisma/schema/connectedAircraft.prisma @@ -1,21 +1,22 @@ model ConnectedAircraft { - id Int @id @default(autoincrement()) - userId String - publicUser Json - lastHeartbeat DateTime @default(now()) - fmsStatus String @default("6") + id Int @id @default(autoincrement()) + userId String + publicUser Json + lastHeartbeat DateTime @default(now()) + fmsStatus String @default("6") // position: - posLat Float? - posLng Float? - posAlt Int? - posSpeed Int? - posHeading Int? - simulator String? - posH145active Boolean @default(false) - stationId Int - loginTime DateTime @default(now()) - esimatedLogoutTime DateTime? - logoutTime DateTime? + posLat Float? + posLng Float? + posAlt Int? + posSpeed Int? + posHeading Int? + simulator String? + posH145active Boolean @default(false) + posXplanePluginActive Boolean @default(false) + stationId Int + loginTime DateTime @default(now()) + esimatedLogoutTime DateTime? + logoutTime DateTime? // relations: User User @relation(fields: [userId], references: [id], onDelete: Cascade) diff --git a/packages/database/prisma/schema/migrations/20251004191000_add_xplane_plugin_parameter/migration.sql b/packages/database/prisma/schema/migrations/20251004191000_add_xplane_plugin_parameter/migration.sql new file mode 100644 index 00000000..a340a34c --- /dev/null +++ b/packages/database/prisma/schema/migrations/20251004191000_add_xplane_plugin_parameter/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "ConnectedAircraft" ADD COLUMN "posXplanePluginActive" BOOLEAN NOT NULL DEFAULT false;