LOLYO-Export nach der LOLYO-Anleitung, Gruppen aus der Org-Struktur
All checks were successful
CI / Lint, Typen, Tests, Build (push) Successful in 11m53s
CI / Migrationen auf leerer Datenbank (push) Successful in 10m31s

- Spalten wie in der Anleitung "Mitarbeiterdaten-Import mittels CSV-Liste":
  Benutzername, E-Mail, Passwort, Titel, Vorname, Nachname, Position,
  Gruppen, Telefon, Anrede. Titel vor und nach dem Namen in einem Feld;
  Sprache und E-Mail bestaetigt entfallen.
- Gruppen: Org-Einheit der Person bis zur obersten, durch Komma getrennt.
  Komma im Namen wird zu " - ", doppelte Namen einmal. Ohne Einheit die
  Gruppe "Mitarbeiter", weil Gruppen ein Pflichtfeld ist.
- orgKette nach lib/org.ts, gemeinsam fuer Honestly und LOLYO.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 11:43:40 +02:00
parent e77eaf7fba
commit 09dcfece20
6 changed files with 145 additions and 79 deletions

View File

@@ -2,6 +2,7 @@ import { NextResponse, type NextRequest } from "next/server";
import { exportFilename, exportResponseHeaders, toCsv, toXlsx } from "@/lib/export";
import { exportParameter, ladeExportMitarbeiter } from "@/lib/export-auswahl";
import { baueLolyoZeile, LOLYO_CSV, lolyoSpalten } from "@/lib/lolyo";
import { orgKette } from "@/lib/org";
import { requireHrUser } from "@/lib/auth/require-hr";
import { withUser } from "@/lib/db";
@@ -33,9 +34,9 @@ export async function GET(request: NextRequest) {
if ("denied" in gate) return gate.denied;
const { format, asOf, filters } = exportParameter(request.nextUrl.searchParams);
const { rows } = await withUser(gate.userId, (tx) => ladeExportMitarbeiter(tx, { asOf, filters }));
const { rows, orgMaps } = await withUser(gate.userId, (tx) => ladeExportMitarbeiter(tx, { asOf, filters }));
const zeilen = rows.map((r) => baueLolyoZeile(r, STARTPASSWORT));
const zeilen = rows.map((r) => baueLolyoZeile(r, STARTPASSWORT, orgKette(orgMaps, r.org_unit_id)));
const spalten = lolyoSpalten();
const filename = exportFilename("lolyo-export", format);