Update src/server/api.ts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d63845ed9a
commit
6ec4d426c9
@ -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))
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user