added force end transmition for dispatchers
This commit is contained in:
@@ -62,6 +62,7 @@ export const handleConnectDispatch =
|
||||
esimatedLogoutTime: parsedLogoffDate?.toISOString() || null,
|
||||
lastHeartbeat: new Date().toISOString(),
|
||||
userId: user.id,
|
||||
zone: selectedZone,
|
||||
loginTime: new Date().toISOString(),
|
||||
},
|
||||
});
|
||||
@@ -72,20 +73,29 @@ export const handleConnectDispatch =
|
||||
io.to("dispatchers").emit("dispatchers-update");
|
||||
io.to("pilots").emit("dispatchers-update");
|
||||
|
||||
// dispatch-events
|
||||
socket.on("ptt", async ({ shouldTransmit, channel }) => {
|
||||
if (shouldTransmit) {
|
||||
io.to("dispatchers").emit("other-ptt", {
|
||||
publicUser: getPublicUser(user),
|
||||
channel,
|
||||
source: "Leitstelle",
|
||||
socket.on("stop-other-transmition", async ({ ownRole, otherRole }) => {
|
||||
const aircrafts = await prisma.connectedAircraft.findMany({
|
||||
where: {
|
||||
Station: {
|
||||
bosCallsignShort: otherRole,
|
||||
},
|
||||
logoutTime: null,
|
||||
},
|
||||
include: {
|
||||
Station: true,
|
||||
},
|
||||
});
|
||||
const dispatchers = await prisma.connectedDispatcher.findMany({
|
||||
where: {
|
||||
zone: otherRole,
|
||||
logoutTime: null,
|
||||
},
|
||||
});
|
||||
[...aircrafts, ...dispatchers].forEach((entry) => {
|
||||
io.to(`user:${entry.userId}`).emit("force-end-transmission", {
|
||||
by: ownRole,
|
||||
});
|
||||
io.to("piots").emit("other-ptt", {
|
||||
publicUser: getPublicUser(user),
|
||||
channel,
|
||||
source: "Leitstelle",
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("disconnect", async () => {
|
||||
|
||||
Reference in New Issue
Block a user