removed console log
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getPublicUser, prisma } from "@repo/db";
|
||||
import { getPublicUser, prisma, User } from "@repo/db";
|
||||
import { channel } from "diagnostics_channel";
|
||||
import { Server, Socket } from "socket.io";
|
||||
|
||||
@@ -6,7 +6,7 @@ export const handleConnectPilot =
|
||||
(socket: Socket, io: Server) =>
|
||||
async ({ logoffTime, stationId }: { logoffTime: string; stationId: string }) => {
|
||||
try {
|
||||
const user = socket.data.user; // User ID aus dem JWT-Token
|
||||
const user: User = socket.data.user; // User ID aus dem JWT-Token
|
||||
const userId = socket.data.user.id; // User ID aus dem JWT-Token
|
||||
|
||||
const Station = await prisma.station.findFirst({
|
||||
@@ -14,10 +14,10 @@ export const handleConnectPilot =
|
||||
id: parseInt(stationId),
|
||||
},
|
||||
});
|
||||
console.log("Pilot connected:", userId);
|
||||
|
||||
if (!user) return Error("User not found");
|
||||
|
||||
console.log("Pilot connected:", user.publicId);
|
||||
const existingConnection = await prisma.connectedAircraft.findFirst({
|
||||
where: {
|
||||
userId: user.id,
|
||||
@@ -73,8 +73,6 @@ export const handleConnectPilot =
|
||||
socket.join(`user:${userId}`); // Join the user-specific room
|
||||
socket.join(`station:${stationId}`); // Join the station-specific room
|
||||
|
||||
console.log(`Pilot in: station:${stationId}`);
|
||||
|
||||
io.to("dispatchers").emit("pilots-update");
|
||||
io.to("pilots").emit("pilots-update");
|
||||
|
||||
@@ -100,7 +98,6 @@ export const handleConnectPilot =
|
||||
});
|
||||
|
||||
socket.on("disconnect", async () => {
|
||||
console.log("Disconnected from dispatch server");
|
||||
await prisma.connectedAircraft
|
||||
.update({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user