import response fixed
This commit is contained in:
@@ -8,10 +8,11 @@ const router: Router = Router();
|
|||||||
|
|
||||||
router.use("/mail", mailRouter);
|
router.use("/mail", mailRouter);
|
||||||
router.use("/event", eventRouter);
|
router.use("/event", eventRouter);
|
||||||
router.get("/import", (req, res) => {
|
router.get("/import", async (req, res) => {
|
||||||
DATA.forEach(async (station) => {
|
await Promise.all(
|
||||||
|
DATA.map(async (station) => {
|
||||||
try {
|
try {
|
||||||
await prisma.station.create({
|
return await prisma.station.create({
|
||||||
data: {
|
data: {
|
||||||
aircraftRegistration: "D-H",
|
aircraftRegistration: "D-H",
|
||||||
aircraft: station.aircraft,
|
aircraft: station.aircraft,
|
||||||
@@ -39,7 +40,9 @@ router.get("/import", (req, res) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error creating station ${station.aircraft}:`, error);
|
console.error(`Error creating station ${station.aircraft}:`, error);
|
||||||
}
|
}
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
res.status(200).json({ message: "Import completed" });
|
||||||
});
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
Reference in New Issue
Block a user