new features

This commit is contained in:
Matthias Hochmeister
2026-03-23 14:01:39 +01:00
parent d2dc64d54a
commit 3326156b15
35 changed files with 1341 additions and 257 deletions

View File

@@ -65,6 +65,23 @@ function mapDienstgrad(raw: string): string | null {
return null;
}
/**
* Valid Austrian/EU driving license class patterns.
* Filters out non-class data that the scraper may pick up from FDISK form fields.
*/
const VALID_LICENSE_CLASSES = new Set([
'A', 'A1', 'A2', 'AM',
'B', 'B1', 'BE',
'C', 'C1', 'CE', 'C1E',
'D', 'D1', 'DE', 'D1E',
'F', 'G', 'L', 'T',
]);
function isValidLicenseClass(klasse: string): boolean {
const normalized = klasse.trim().toUpperCase();
return VALID_LICENSE_CLASSES.has(normalized);
}
export async function syncToDatabase(
pool: Pool,
members: FdiskMember[],
@@ -362,6 +379,13 @@ async function syncFahrgenehmigungen(
}
for (const f of fahrgenehmigungen) {
// J2: Filter out non-class data that the scraper may pick up
if (!f.klasse || !isValidLicenseClass(f.klasse)) {
log(`Skipping Fahrgenehmigung: invalid klasse "${f.klasse}" for StNr ${f.standesbuchNr}`);
skipped++;
continue;
}
const result = await client.query<{ user_id: string }>(
`SELECT user_id FROM mitglieder_profile WHERE fdisk_standesbuch_nr = $1`,
[f.standesbuchNr]