Einsatz geschlossen event wird richtig an piloten gesendet
This commit is contained in:
@@ -88,7 +88,16 @@ router.patch("/:id", async (req, res) => {
|
||||
});
|
||||
io.to("dispatchers").emit("update-mission", { updatedMission });
|
||||
if (req.body.state === "finished") {
|
||||
updatedMission.missionStationUserIds?.forEach((userId) => {
|
||||
const missionUsers = await prisma.missionOnStationUsers.findMany({
|
||||
where: {
|
||||
missionId: updatedMission.id,
|
||||
},
|
||||
select: {
|
||||
userId: true,
|
||||
},
|
||||
});
|
||||
console.log("Notifying users about mission closure:", missionUsers);
|
||||
missionUsers?.forEach(({ userId }) => {
|
||||
io.to(`user:${userId}`).emit("notification", {
|
||||
type: "mission-closed",
|
||||
status: "closed",
|
||||
|
||||
Reference in New Issue
Block a user