| 1 | import { pb } from "./pb"; |
| 2 | |
| 3 | const airports = await pb.collection("airports").getFullList(); |
| 4 | |
| 5 | for (const airport of airports) { |
| 6 | const record = await pb.collection("airports").getOne(airport.id); |
| 7 | const data = await fetch("http://localhost:5000/v1/airports", { |
| 8 | method: "POST", |
| 9 | body: JSON.stringify({ |
| 10 | ident: record.ident, |
| 11 | type: record.type, |
| 12 | elevation: Number(record.elevation), |
| 13 | continent: record.continent, |
| 14 | isoCountry: record.iso_country, |
| 15 | municipality: record.municipality, |
| 16 | gpsCode: record.gps_code, |
| 17 | iataCode: record.iata_code, |
| 18 | name: record.name, |
| 19 | lat: record.lat, |
| 20 | long: record.long, |
| 21 | isoRegion: record.iso_region, |
| 22 | }), |
| 23 | headers: { |
| 24 | "Content-Type": "application/json", |
| 25 | }, |
| 26 | }); |
| 27 | console.log(await data.json()); |
| 28 | } |