cleaned code, added hpg validation in Mission Marker

This commit is contained in:
PxlLoewe
2025-05-22 01:10:08 -07:00
parent 8a4b42f02b
commit 05e74077a5
7 changed files with 209 additions and 296 deletions

View File

@@ -4,13 +4,7 @@ import { Server, Socket } from "socket.io";
export const handleConnectPilot =
(socket: Socket, io: Server) =>
async ({
logoffTime,
stationId,
}: {
logoffTime: string;
stationId: string;
}) => {
async ({ logoffTime, stationId }: { logoffTime: string; stationId: string }) => {
try {
const user = socket.data.user; // User ID aus dem JWT-Token
const userId = socket.data.user.id; // User ID aus dem JWT-Token
@@ -32,9 +26,7 @@ export const handleConnectPilot =
});
if (existingConnection) {
await io
.to(`user:${user.id}`)
.emit("force-disconnect", "double-connection");
await io.to(`user:${user.id}`).emit("force-disconnect", "double-connection");
await prisma.connectedAircraft.updateMany({
where: {
userId: user.id,
@@ -72,6 +64,7 @@ export const handleConnectPilot =
stationId: parseInt(stationId),
posLat: 51.45,
posLng: 9.77,
posH145active: true,
},
});