added ntfy
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { prisma } from "@repo/db";
|
||||
import { Router } from "express";
|
||||
import { io } from "../index";
|
||||
import { sendNtfyMission } from "modules/ntfy";
|
||||
|
||||
const router = Router();
|
||||
|
||||
@@ -107,6 +108,9 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
},
|
||||
logoutTime: null,
|
||||
},
|
||||
include: {
|
||||
Station: true,
|
||||
},
|
||||
});
|
||||
|
||||
for (const aircraft of connectedAircrafts) {
|
||||
@@ -115,6 +119,18 @@ router.post("/:id/send-alert", async (req, res) => {
|
||||
...mission,
|
||||
Stations,
|
||||
});
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: aircraft.userId },
|
||||
});
|
||||
if (!user) continue;
|
||||
if (user.settingsNtfyRoom) {
|
||||
await sendNtfyMission(
|
||||
mission,
|
||||
Stations,
|
||||
aircraft.Station,
|
||||
user.settingsNtfyRoom,
|
||||
);
|
||||
}
|
||||
const existingMissionOnStationUser =
|
||||
await prisma.missionOnStationUsers.findFirst({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user