import response fixed
This commit is contained in:
@@ -8,38 +8,41 @@ 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(
|
||||||
try {
|
DATA.map(async (station) => {
|
||||||
await prisma.station.create({
|
try {
|
||||||
data: {
|
return await prisma.station.create({
|
||||||
aircraftRegistration: "D-H",
|
data: {
|
||||||
aircraft: station.aircraft,
|
aircraftRegistration: "D-H",
|
||||||
aircraftSpeed: station.aircraftSpeed,
|
aircraft: station.aircraft,
|
||||||
atcCallsign: station.atcCallsign,
|
aircraftSpeed: station.aircraftSpeed,
|
||||||
bosCallsign: station.bosCallsign,
|
atcCallsign: station.atcCallsign,
|
||||||
bosCallsignShort: station.bosCallsignShort,
|
bosCallsign: station.bosCallsign,
|
||||||
bosRadioArea: station.bosRadioArea,
|
bosCallsignShort: station.bosCallsignShort,
|
||||||
fir: station.fir,
|
bosRadioArea: station.bosRadioArea,
|
||||||
operator: station.operator,
|
fir: station.fir,
|
||||||
bosUse: "PRIMARY",
|
operator: station.operator,
|
||||||
country: station.country as Country,
|
bosUse: "PRIMARY",
|
||||||
hasNvg: station.hasNvg,
|
country: station.country as Country,
|
||||||
hasRope: station.hasRope,
|
hasNvg: station.hasNvg,
|
||||||
hasWinch: station.hasWinch,
|
hasRope: station.hasRope,
|
||||||
is24h: station.is24h,
|
hasWinch: station.hasWinch,
|
||||||
hideRangeRings: station.hideRangeRings,
|
is24h: station.is24h,
|
||||||
locationState: station.locationState,
|
hideRangeRings: station.hideRangeRings,
|
||||||
locationStateShort: station.locationStateShort,
|
locationState: station.locationState,
|
||||||
|
locationStateShort: station.locationStateShort,
|
||||||
|
|
||||||
latitude: station.latitude,
|
latitude: station.latitude,
|
||||||
longitude: station.longitude,
|
longitude: station.longitude,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} 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