Made Aircrafts fetch from Server. Added OSM Objects to mission
This commit is contained in:
@@ -42,7 +42,7 @@ router.put("/", async (req, res) => {
|
||||
const newMission = await prisma.mission.create({
|
||||
data: req.body,
|
||||
});
|
||||
io.to("missions").emit("new-mission", newMission);
|
||||
io.to("dispatchers").emit("new-mission", newMission);
|
||||
res.status(201).json(newMission);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: "Failed to create mission" });
|
||||
@@ -57,7 +57,7 @@ router.patch("/:id", async (req, res) => {
|
||||
where: { id: Number(id) },
|
||||
data: req.body,
|
||||
});
|
||||
io.to("missions").emit("update-mission", updatedMission);
|
||||
io.to("dispatchers").emit("update-mission", updatedMission);
|
||||
res.json(updatedMission);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -72,7 +72,7 @@ router.delete("/:id", async (req, res) => {
|
||||
await prisma.mission.delete({
|
||||
where: { id: Number(id) },
|
||||
});
|
||||
io.to("missions").emit("delete-mission", id);
|
||||
io.to("dispatchers").emit("delete-mission", id);
|
||||
res.status(204).send();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
Reference in New Issue
Block a user