cleaned code, added hpg validation in Mission Marker
This commit is contained in:
@@ -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,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user