Simulator nicht verbunden warnung
This commit is contained in:
@@ -5,7 +5,15 @@ import { Server, Socket } from "socket.io";
|
||||
|
||||
export const handleConnectPilot =
|
||||
(socket: Socket, io: Server) =>
|
||||
async ({ logoffTime, stationId }: { logoffTime: string; stationId: string }) => {
|
||||
async ({
|
||||
logoffTime,
|
||||
stationId,
|
||||
debug,
|
||||
}: {
|
||||
logoffTime: string;
|
||||
stationId: string;
|
||||
debug: boolean;
|
||||
}) => {
|
||||
try {
|
||||
if (!stationId) return Error("Station ID is required");
|
||||
const user: User = socket.data.user; // User ID aus dem JWT-Token
|
||||
@@ -78,8 +86,7 @@ export const handleConnectPilot =
|
||||
return { lat, lng };
|
||||
}
|
||||
|
||||
const randomPos =
|
||||
process.env.environment === "development" ? getRandomGermanPosition() : undefined;
|
||||
const randomPos = debug ? getRandomGermanPosition() : undefined;
|
||||
|
||||
const connectedAircraftEntry = await prisma.connectedAircraft.create({
|
||||
data: {
|
||||
@@ -87,8 +94,7 @@ export const handleConnectPilot =
|
||||
esimatedLogoutTime: parsedLogoffDate?.toISOString() || null,
|
||||
userId: userId,
|
||||
stationId: parseInt(stationId),
|
||||
lastHeartbeat:
|
||||
process.env.environment === "development" ? nowPlus2h.toISOString() : undefined,
|
||||
lastHeartbeat: debug ? nowPlus2h.toISOString() : undefined,
|
||||
posLat: randomPos?.lat,
|
||||
posLng: randomPos?.lng,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user