Fixed Automatische alarmierung nach validierung #45
This commit is contained in:
@@ -9,7 +9,7 @@ export const sendAlert = async (
|
||||
}: {
|
||||
stationId?: number;
|
||||
},
|
||||
user: User,
|
||||
user: User | "HPG",
|
||||
): Promise<{
|
||||
connectedAircrafts: ConnectedAircraft[];
|
||||
mission: Mission;
|
||||
@@ -89,23 +89,38 @@ export const sendAlert = async (
|
||||
.catch((err) => {
|
||||
// Ignore if the entry already exists
|
||||
});
|
||||
|
||||
await prisma.mission.update({
|
||||
where: { id: Number(id) },
|
||||
data: {
|
||||
state: "running",
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "alert-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
stationId: stationId,
|
||||
user: getPublicUser(user, { ignorePrivacy: true }),
|
||||
},
|
||||
} as any,
|
||||
if (user === "HPG") {
|
||||
await prisma.mission.update({
|
||||
where: { id: Number(id) },
|
||||
data: {
|
||||
state: "running",
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "alert-log",
|
||||
auto: true,
|
||||
timeStamp: new Date().toISOString(),
|
||||
} as any,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
} else {
|
||||
await prisma.mission.update({
|
||||
where: { id: Number(id) },
|
||||
data: {
|
||||
state: "running",
|
||||
missionLog: {
|
||||
push: {
|
||||
type: "alert-log",
|
||||
auto: false,
|
||||
timeStamp: new Date().toISOString(),
|
||||
data: {
|
||||
stationId: stationId,
|
||||
user: getPublicUser(user, { ignorePrivacy: true }),
|
||||
},
|
||||
} as any,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return { connectedAircrafts, mission };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user