Multi-Standort-Verwaltung
Büros in mehreren Ländern automatisch synchronisieren und Jobs nach Standort filtern.
Das Problem
Airlines und Flugbetriebe mit mehreren Standorten (Bases) müssen Jobs und Bewerbungen nach Standort sortieren. Wenn ein neues Büro eröffnet wird, muss es in AeroHire manuell angelegt werden.
Lösung: Automatische Büro-Synchronisierung
sync-offices.jsJavaScript
const BASE = "https://api.aeroselect.io/api/v2/external";
// Sync offices from your ERP/HR system with AeroHire
async function syncOffices(erpOffices) {
// Fetch existing AeroHire offices
const res = await fetch(`${BASE}/offices`, {
headers: { "X-API-Key": process.env.AEROSELECT_API_KEY },
});
const { data: existingOffices } = await res.json();
const existingMap = new Map(
existingOffices.map((o) => [o.iata_code, o])
);
for (const office of erpOffices) {
if (existingMap.has(office.iata_code)) {
// Bestehendes Büro aktualisieren
await fetch(
`${BASE}/offices/${existingMap.get(office.iata_code).id}`,
{
method: "PATCH",
headers: {
"X-API-Key": process.env.AEROSELECT_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ name: office.name, city: office.city }),
}
);
} else {
// Neues Büro erstellen
await fetch(`${BASE}/offices`, {
method: "POST",
headers: {
"X-API-Key": process.env.AEROSELECT_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: office.name,
city: office.city,
country: office.country_code,
iata_code: office.iata_code,
}),
});
}
}
}IATA-Codes als eindeutige Keys
Verwende IATA-Codes als eindeutige Identifier für Büros (FRA, MUC, VIE etc.), um Duplikate zu vermeiden.
Jobs nach Standort filtern
filter-by-location.pyPython
import requests
BASE = "https://api.aeroselect.io/api/v2/external"
def get_jobs_by_location(location: str) -> list:
"""Fetch all active jobs at a location."""
response = requests.get(
f"{BASE}/jobs",
headers={"X-API-Key": os.environ["AEROSELECT_API_KEY"]},
params={"status": "online", "search": location}
)
return response.json()["data"]
// Jobs pro Basis abrufen
bases = ["FRA", "MUC", "VIE", "ZRH"]
for base in bases:
jobs = get_jobs_by_location(base)
print(f"{base}: {len(jobs)} aktive Stellen")Dashboard: Bewerbungen pro Standort
location-dashboard.jsJavaScript
async function getApplicationsByLocation() {
const API_KEY = process.env.AEROSELECT_API_KEY;
const BASE = "https://api.aeroselect.io/api/v2/external";
const [jobsRes, appsRes] = await Promise.all([
fetch(`${BASE}/jobs?status=online&per_page=100`, {
headers: { "X-API-Key": API_KEY }
}),
fetch(`${BASE}/applications?per_page=100`, {
headers: { "X-API-Key": API_KEY }
}),
]);
const { data: jobs } = await jobsRes.json();
const { data: applications } = await appsRes.json();
// Bewerbungen nach Job gruppieren
const jobMap = new Map(jobs.map((j) => [j.id, j]));
// Bewerbungsanzahl pro Standort
const byLocation = {};
for (const app of applications) {
const job = jobMap.get(app.job_id);
if (!job) continue;
byLocation[job.location] = (byLocation[job.location] || 0) + 1;
}
return byLocation;
// { "Frankfurt (FRA)": 47, "München (MUC)": 23, ... }
}