This commit is contained in:
PxlLoewe
2025-07-06 00:36:48 -07:00
parent 2cdbab9f28
commit a9d20e018d
13 changed files with 72 additions and 19 deletions

View File

@@ -282,8 +282,20 @@ router.post("/:id/hpg-validation-result", async (req, res) => {
router.post("/:id/validate-hpg", async (req, res) => {
try {
const config = await prisma.config.findFirst({
orderBy: {
createdAt: "desc",
},
});
if (config?.disableHPG) {
res.status(400).json({
error: "HPG is disabled",
});
return;
}
const { id } = req.params;
const config = req.body as
const body = req.body as
| {
alertWhenValid?: boolean;
}
@@ -336,7 +348,7 @@ router.post("/:id/validate-hpg", async (req, res) => {
io.to(`desktop:${activeAircraftinMission?.userId}`).emit("hpg-validation", {
missionId: parseInt(id),
userId: req.user?.id,
alertWhenValid: config?.alertWhenValid || false,
alertWhenValid: body?.alertWhenValid || false,
});
} catch (error) {
console.error(error);