changed toast timer, redirect behavior in disptach, VehicleNames
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
import {
|
||||
getPublicUser,
|
||||
HpgValidationState,
|
||||
MissionAlertLog,
|
||||
MissionSdsLog,
|
||||
MissionStationLog,
|
||||
NotificationPayload,
|
||||
Prisma,
|
||||
prisma,
|
||||
User,
|
||||
} from "@repo/db";
|
||||
import { Router } from "express";
|
||||
import { io } from "../index";
|
||||
import { sendNtfyMission } from "modules/ntfy";
|
||||
import { sendAlert } from "modules/mission";
|
||||
import { userInfo } from "os";
|
||||
|
||||
const router: Router = Router();
|
||||
|
||||
@@ -119,7 +114,7 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
const { id } = req.params;
|
||||
const { stationId, vehicleName } = req.body as {
|
||||
stationId?: number;
|
||||
vehicleName?: "ambulance" | "police" | "firebrigade";
|
||||
vehicleName?: "RTW" | "POL" | "FW";
|
||||
};
|
||||
|
||||
if (!req.user) {
|
||||
@@ -142,9 +137,9 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
id: Number(id),
|
||||
},
|
||||
data: {
|
||||
hpgAmbulanceState: vehicleName === "ambulance" ? "DISPATCHED" : undefined,
|
||||
hpgFireEngineState: vehicleName === "firebrigade" ? "DISPATCHED" : undefined,
|
||||
hpgPoliceState: vehicleName === "police" ? "DISPATCHED" : undefined,
|
||||
hpgAmbulanceState: vehicleName === "RTW" ? "DISPATCHED" : undefined,
|
||||
hpgFireEngineState: vehicleName === "FW" ? "DISPATCHED" : undefined,
|
||||
hpgPoliceState: vehicleName === "POL" ? "DISPATCHED" : undefined,
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "alert-log",
|
||||
@@ -152,7 +147,7 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
vehicle: vehicleName,
|
||||
user: getPublicUser(req.user as User),
|
||||
user: getPublicUser(req.user as User, { ignorePrivacy: true }),
|
||||
},
|
||||
} as any,
|
||||
},
|
||||
@@ -162,9 +157,9 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
io.to(`desktop:${aircraft.userId}`).emit("hpg-vehicle-update", {
|
||||
missionId: id,
|
||||
vehicleData: {
|
||||
ambulanceState: newMission.hpgAmbulanceState,
|
||||
RTWState: newMission.hpgAmbulanceState,
|
||||
fireEngineState: newMission.hpgFireEngineState,
|
||||
policeState: newMission.hpgPoliceState,
|
||||
POLState: newMission.hpgPoliceState,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user