Update src/server/api.ts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
sora-ext 2025-02-25 18:03:07 +01:00
parent d63845ed9a
commit 6ec4d426c9

View File

@ -10,6 +10,14 @@ setGlobalDispatcher(new ProxyAgent(process.env.HTTPS_PROXY as string));
export default function (server, opts, done) {
server.get("/flight/:id", async (req, reply) =>
flight_get_data(req.params.id)
.then(res => {
let wait_for_all: Promise<any>[] = []
res.forEach(r => {
wait_for_all.push(nominatim_get_data(r.from).then(geo => (r as any).from_geo = geo[0]));
wait_for_all.push(nominatim_get_data(r.to).then(geo => (r as any).to_geo = geo[0]));
});
return Promise.all(wait_for_all).then(_ => res)
})
.then(res => reply.send(res))
);