dev
This commit is contained in:
@@ -122,11 +122,15 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
res.status(404).json({ error: "Mission not found" });
|
||||
return;
|
||||
}
|
||||
|
||||
// connectedAircrafts the alert is sent to
|
||||
const connectedAircrafts = await prisma.connectedAircraft.findMany({
|
||||
where: {
|
||||
stationId: {
|
||||
in: mission.missionStationIds,
|
||||
},
|
||||
stationId: stationId
|
||||
? stationId
|
||||
: {
|
||||
in: mission.missionStationIds,
|
||||
},
|
||||
logoutTime: null,
|
||||
},
|
||||
include: {
|
||||
@@ -135,7 +139,6 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
});
|
||||
|
||||
for (const aircraft of connectedAircrafts) {
|
||||
if (stationId && stationId !== aircraft.stationId) continue;
|
||||
console.log(`Sending mission to: station:${aircraft.stationId}`);
|
||||
io.to(`station:${aircraft.stationId}`).emit("mission-alert", {
|
||||
...mission,
|
||||
|
||||
Reference in New Issue
Block a user