Neue Spalte employees.c_level mit CHECK auf die zehn Codes (C1, C11, C2,
C3, C4, C8, C9, MG, P, VD), freiwillig. hire_employee, rehire_employee,
change_employee_data, apply_due_pending_changes und app_feld_karte werden
aus ihrer gespeicherten Definition ergaenzt; Leeren ist moeglich.
is_c_level bleibt in der Datenbank und wird nicht mehr geschrieben.
Vorhandene Historieneintraege dazu heissen "C-Level (Ja/Nein)" und lassen
sich weiter berichtigen und loeschen. Die IT-Sicht zeigt c_level statt
is_c_level.
Oberflaeche: Auswahl mit "Bitte waehlen..." in Einstellung,
Wiedereintritt, Uebernahme und Daten aendern; Anzeige als Code und
Bezeichnung (C9 - Mitarbeiter) in Akte, Zusammenfassung und Historie.
Berichte: Mehrfachauswahl statt Ja/Nein, Gruppierung nach Stufe mit
"Ohne C-Level". Export: Spalten "C-Level" und "C-Level Bezeichnung".
Import: Code oder Code mit Bezeichnung.
Geprueft: lint, tsc, types:check, npm test, waechter; Migrationen auf
leerer Datenbank zweimal (Nichts anzuwenden), rauchtest.sql,
vertragsangaben.sql; Einstellung mit C9, Aenderung C9 -> C4 in der
Historie, andere Aenderung laesst C-Level stehen, Leeren, Vormerkung und
Nachtlauf (MG), ungueltiger Code abgewiesen, it_lesen liest die Sicht;
alter Historieneintrag umbenannt und weiter loeschbar.
Staatsbuergerschaft: die Spalte war Pflicht mit Vorgabe "Oesterreich",
hire_employee setzte sie ohne Angabe ein. Ein leeres Feld stand damit als
Angabe in der Akte. 20261105130000 macht sie freiwillig ohne Vorgabe;
hire, rehire, change_employee_data und der naechtliche Lauf nehmen die
leere Zeichenkette als null (case when ? then nullif). Bestehende Zeilen
bleiben. Die Uebernahme schickt das Feld auch leer und raeumt so die
Vorgabe der externen Person weg.
Neueinstellung: Geschlecht und Staatsbuergerschaft stehen leer,
Geschlecht ist Pflicht mit "Bitte waehlen".
Geburtsdatum in der Zukunft: auch bei Angehoerigen (Assistent und Akte)
und in "Eintrag berichtigen" abgewiesen.
"Uebernahme Leiharbeitskraft": nur noch im Assistenten "Uebernahme". Aus
Neueinstellung und Wiedereintritt entfernt; in "Daten aendern" nur bei
Personen, die das Kennzeichen tragen, zum Berichtigen.
Geprueft: lint, tsc, types:check, npm test (1075), waechter; alle
Migrationen auf leerer Datenbank, zweiter Lauf "Nichts anzuwenden";
rauchtest.sql und vertragsangaben.sql bestanden. Nicht im Browser geprueft.
Uebernahme: die Schritte der Neueinstellung ausser der Planstelle -
dazu Angehoerige und Notfallkontakt. Beide werden nach der Uebernahme
angelegt (add_employee_dependent, add_emergency_contact); scheitert
einer, sagt die Meldung, wer fehlt. Bestehende bleiben in der Akte.
Staatsbuergerschaft und Land stehen leer, wenn bei der externen Person
nur die Vorgabe der Spalte steht; eine leere Staatsbuergerschaft wird
nicht geschickt und laesst den gespeicherten Wert stehen.
Geburtsdatum: in der Zukunft oder nicht vor dem Eintritt haelt
Neueinstellung (intern und extern), Wiedereintritt und Uebernahme an und
steht am Feld (lib/geburtsdatum.ts). "Daten aendern" weist es ab, wenn
das Geburtsdatum dort geaendert wird.
Geprueft: lint, tsc, types:check, npm test (1072), waechter. Nicht im
Browser geprueft.
Uebernahme: neuer Knopf "Uebernahme" in der Akte, nur bei externer
Besetzung ohne erfassten Austritt. Der Assistent fragt Tag, Person und
Vertrag wie eine Einstellung, vorbelegt aus der Akte, Planstelle und
Notfallkontakte bleiben. uebernahme_erfassen (20261105120000) setzt die
Besetzungsart auf Intern ueber change_employee_data, das das Ereignis
"Uebernahme" schreibt, und auf Wunsch eine neue Personalnummer (sofort
wirksam, in der Zeile "Uebernahme" und im Protokoll). In "Daten aendern"
ist die Besetzungsart bei externen Personen gesperrt und verweist auf den
Knopf.
Weiter: in Neueinstellung, Wiedereintritt und Uebernahme immer
bedienbar. An einem unvollstaendigen Schritt bleibt der Assistent stehen,
leere Pflichtfelder tragen "Bitte ausfuellen.", dazu ein Hinweis. Die
Markierung kommt ueber einen Kontext in components/ui/Field.tsx und
greift an jedem Feld mit required.
Wochenstunden: Teilzeit mit 38,5 Stunden oder mehr haelt im Schritt
Vertrag an und steht am Feld, statt erst beim Anlegen an chk_weekly_hours
zu scheitern (lib/wochenstunden.ts, auch fuer "Eintrag berichtigen").
Mitarbeiterliste: Statusfilter "Austritt geplant" - erfasster Austritt
nach heute, ohne Nichtantritt, sortiert nach dem naechsten Austritt.
Rauchtest 35c: Uebernahme mit neuer Personalnummer, vergebene Nummer und
zweite Uebernahme abgewiesen.
Geprueft: lint, tsc, types:check, npm test (1065), waechter; alle
Migrationen auf leerer Datenbank, zweiter Lauf "Nichts anzuwenden";
rauchtest.sql und vertragsangaben.sql bestanden. Nicht im Browser geprueft.
Fachlich vorgegeben: bei Besetzung "Extern" fragt die Einstellung nur
Vorname, Nachname, Geschlecht, Geburtsdatum, OE (Planstelle) und
Standort. Vertrag, Angehoerige und Notfallkontakt fuehrt der Ueberlasser.
- Der Assistent hat bei "Extern" drei Schritte: Eintritt, Externe Person,
Zusammenfassung. Die Personalnummer steht mit dabei - die Anwendung
fuehrt jede Person ueber sie.
- Geschickt wird nur, was die Maske fragt; was vor dem Wechsel auf
"Extern" in anderen Schritten stand, geht nicht mit. Den Rest setzt
hire_employee auf seine Vorgaben.
- Die Zusammenfassung zeigt bei "Extern" keine Vorgaben, die niemand
erfasst hat (Vollzeit, unbefristet ...).
Geprueft: lint, tsc, 1007 Tests (neu: Abfolge, Pflichtfelder,
Zusammenfassung und gesendete Angaben bei externer Besetzung),
Uebergabe-Waechter.
Neues Kennzeichen "Uebernahme Leiharbeitskraft" mit einem freien Feld
dazu, das erst mit dem Haken erscheint. Gefragt bei interner Besetzung in
Einstellung und Wiedereintritt, aenderbar in "Daten aendern", sichtbar in
den Stammdaten, der Zusammenfassung und im Mitarbeiterexport.
Die Spalten gehoeren zur Gruppe person. Einstellung, Wiedereintritt,
"Daten aendern", Nachtlauf und Feldkarte sind an der laufenden Definition
ergaenzt; ein CHECK haelt Angaben ohne Kennzeichen fern, die Funktionen
leeren sie beim Entfernen des Hakens.
Geprueft: lint, tsc, types:check, 957 Tests, Waechter; alle Migrationen auf
leerer Datenbank, zweiter Lauf ohne Befund; Rauchtest 32/32 mit neuem
Schritt; datierte Aenderung im Nachtlauf als alpenwerk_app.
Bei der Beschaeftigtengruppe "Lehrling" fragen Einstellung,
Wiedereintritt und Daten aendern nach Beginn und Ende der Lehrzeit (beide
freiwillig, Ende nach Beginn: chk_lehrzeit). Bei jeder anderen Gruppe
bleiben sie leer. Sichtbar im Reiter Vertrag und in der Zusammenfassung der
Einstellung, in der Historie berichtigbar, im Nachtlauf mitgefuehrt.
Rauchtest: Schritt 27.
Geprueft: lint, tsc, types:check, 947 Tests, Uebergabe-Waechter
- Statuschip: bei Ausgetretenen das Austrittsdatum in Klammern (Liste und
Akte).
- "Beguenstigt behindert" steht auf derselben Ebene wie der besondere
Kuendigungsschutz und gilt auch ohne ihn; nennt der Personenkreis die
Beguenstigung, ist das Kaestchen angehakt und gesperrt.
- Personenkreis "Schwangerschaft" heisst in Anzeige und Export
"Mutterschutz"; gespeichert bleibt der Wert. lib/ohne-gendern.ts wird
dafuer zu lib/anzeige.ts (anzeige, anzeigeAuswahl).
- Geplante Versetzung und Befoerderung lassen sich aendern: Stift in der
Historie oeffnet Versetzen bzw. Befoerdern vorbelegt (Datum, Planstelle,
Bezeichnung, Hay-Grade). Gespeichert wird als Abbrechen und neu Erfassen
in einer Transaktion (geplantenVorgangErsetzen), damit dieselben
Pruefungen gelten wie bei einer neuen; scheitert eine, bleibt die alte
Vormerkung stehen. Ohne Migration.
Geprueft: lint, tsc, types:check, 904 Tests, Waechter
Fachlich vorgegeben: nicht gendern, auch in den Exporten. Gespeichert
bleibt der Wert der Datenbank ("Angestellte:r", "Arbeiter:in",
"Praktikant:in", "Ehepartner:in", "Lebenspartner:in") - er steht in
Aufzaehlungstypen, Pruefbedingungen, der Historie und der Sicht fuer die
IT. Uebersetzt wird nur die Anzeige.
lib/ohne-gendern.ts: eine Regel ueber den Text (":innen", ":in", "e:r",
"e:n"), damit auch Texte aus der Datenbank wie "Angehoerige:r
hinzugefuegt" und Feldnamen der Historie ohne Gendern erscheinen.
Auswahllisten senden weiter den gespeicherten Wert.
Angewendet in Formularen, Historie, Protokoll, Berichten und Filtern,
Mitarbeiter- und Ereignisexport, Importvorlage; der Import nimmt beide
Schreibweisen an. Feste Texte (Menue, Liste, Notizen, Anmeldung)
direkt umformuliert.
Geprueft: lint, tsc, types:check, 885 Tests, Waechter
- Migration 20261015150000: gender_type um d, o, i erweitert (add value,
aus demselben Grund wie bei worker_type: die Sicht it.mitarbeiter
liest die Spalte). Die Funktionen wandeln mit ::gender_type um und
nehmen die Werte ohne Aenderung an.
- lib/geschlecht.ts fuehrt Kuerzel und Bezeichnung. Formulare
(Einstellung, Daten aendern), Stammdaten, Zusammenfassung,
Mitarbeiterexport, Berichtsfilter und Import lesen von dort. Die
Anzeigen der Form gender === "m" ? "maennlich" : "weiblich" sind
ersetzt; sie haetten jeden weiteren Wert als "weiblich" gezeigt.
- Cornerstone fuehrt d/o/i als "not specified", LOLYO laesst die Anrede
leer (beides schon bisher das Verhalten fuer unbekannte Werte).
Geprueft: lint, tsc, types:check, 857 Tests (neu: geschlecht.test.ts),
Waechter; Migration in der CI.
- Neues freiwilliges Textfeld "Erlernter Beruf": Hiring Wizard (Person,
Zusammenfassung), Daten aendern, Stammdaten, Wiedereintritt, Export,
Historie. Gespeichert getrimmt, leer heisst nicht erfasst.
- Reports: Aufteilen nach "Zustaendige HR" mit Gruppe "Nicht zugeordnet"
und Vorlage "Headcount nach zustaendiger HR".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vertrag: VL (1-8, freiwillig) und Bonusanspruch (Vorgabe Nein; bei Ja eine
Bonusregelung: RL ab 01.01.2027, RL bis 31.12.2026, Aussendienst, Shop)
direkt nach dem Hay-Grade -- im Einstellungsassistenten, im Wiedereintritt
und in "Daten aendern", sichtbar im Reiter Vertrag und im Datenexport.
Stammdaten: zustaendige HR. Auswaehlbar sind alle aktiven HR-Konten; die
Datenbank prueft das. Historie und Audit-Log zeigen den Namen.
Kollektivvertraege: Suessware Arbeiter, Suessware Angestellter, Handel.
collective_agreement wird wie der Hay-Grade eine Domain ueber text. Der
Bestand mit "Suesswaren" wird nach der Beschaeftigtengruppe aufgeteilt
(Angestellte -> Angestellter, Arbeiter:innen und Lehrlinge -> Arbeiter),
ebenso geplante Aenderungen und Entwuerfe.
Die Funktionen werden an einzeiligen Ankern der laufenden Definition
ergaenzt (Einstellung, Wiedereintritt, Daten aendern, Nachtlauf,
Feldkarte). app_feld_karte hatte mit 100 Argumenten die Grenze von
jsonb_build_object erreicht; die neuen Felder stehen in einem zweiten
Objekt.
Gegen eine frische Datenbank geprueft: alle Migrationen samt
Selbstpruefung, zweiter Lauf leer, db/tests/rauchtest.sql und der neue
db/tests/vertragsangaben.sql (9 Schritte) bestanden, Umstellung des
Suesswaren-Bestands nachgestellt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A--F stammte aus der Spezifikation, nicht vom Kunden: sechs erfundene Stufen
mit erfundenen Beschreibungen. Der Kunde bewertet nach Hay und hat die Liste
geschickt -- 13 Stufen plus einen Generic Grade.
Dieselbe Spalte fuellt im Cornerstone-Extrakt die Grade ID. Solange dort A--F
steht, ist die Datei in jeder Zeile falsch, ohne dass es beim Erzeugen
auffaellt: das Zielsystem kennt diese Kennungen nicht.
Der Typ heisst weiter paygrade_type, ist aber jetzt eine Domain ueber text mit
CHECK statt eines Aufzaehlungstyps. Ein Enum laesst sich nicht umschreiben --
Werte entfernen geht gar nicht, und add value darf im selben Vorgang, der den
neuen Wert schreibt, nicht benutzt werden. Wichtiger: die rund zehn
SQL-Funktionen, die den Wert nach paygrade_type umwandeln, bleiben unveraendert
gueltig. Jede von ihnen neu zu erzeugen hiesse, zehnmal die Gelegenheit zu
haben, aus einer veralteten Vorlage zu kopieren.
Zwei Funktionen muessen doch angefasst werden, beide per Punktaenderung an der
laufenden Definition statt per Kopie aus einer Datei: der Vorgabewert B in
hire_employee und die Beschriftung im Protokoll von promote_employee.
Der Bestand bekommt den Generic Grade. Aus A--F liesse sich kein Hay-Grade
ableiten: andere Einteilung, andere Anzahl. Geraten saehe im Extrakt genauso
aus wie erhoben.
worker_type had two values because the field was named after them:
"Angestellte:r / Arbeiter:in". Lehrlinge are the third social-insurance
category in Austria; until now they were filed as one of the other two,
which they are not -- and which skewed every report grouped by this
column by exactly those people.
Adding the value is one line. The label was the work: the field was
called after its two values in six places, and each of them becomes
wrong with a third. They now read "Beschaeftigtengruppe", the name the
import has used all along.
One label deliberately keeps the old wording: app_feld_karte() in the
database. That string is not a caption there but a key -- stored rows in
employee_history and pending_changes carry it, and the map is how
reverting or correcting a history entry finds the field again. Renaming
it without rewriting those rows would make every older entry for this
field unrevertable, and nobody would notice until they tried.
The migration's assertion reads pg_enum rather than comparing against
'Lehrling'::worker_type: migrations run inside a transaction, and
Postgres refuses to use a freshly added enum value in the transaction
that added it. This has not been run against a live database here -- the
CI migration job is the first real execution.
Three hand-kept lists of the same enum (reports, import, the form) now
have a test holding them to one another, each mutation-checked.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Works council members, expectant mothers, parents on leave, registered
disabled employees, apprentices — each has its own rules that come
before a dismissal. The tool does not judge whether one is lawful, but
it must not stay quiet about it either, and looking it up on the
contract tab is exactly the step that gets skipped under time pressure.
So: a checkbox, an optional end date, and a red warning at the top of
the termination panel naming the date — or saying plainly that no end
was recorded. It shows for a no-show too; the protection runs from the
start of the contract, not the first day worked.
The date is optional on purpose. A works council mandate has a known
end, a pregnancy does not, and a mandatory field would force an invented
number. A constraint says only what cannot be: an end date without the
flag, which would be a leftover nobody could interpret.
The field goes the whole way through — hire, data change, contract
sheet, export, report criteria (as a yes/no and as a date range), and
the import. A field that exists in one screen and not the next is how
people stop trusting the numbers.
Terminating is now offered for planned entries as well, labelled "Nicht
angetreten", with No Show preselected. Without it a person who never
turned up stayed a planned entry forever, since nothing else can end
one.
One finding worth recording: tsc has been reporting success on a broken
program. A generated file under .next got corrupted when a build ran
against a live dev server, and its syntax errors suppressed semantic
checking everywhere else — two genuine type errors in this change went
unreported until I typechecked with .next excluded. The file is removed
and the ordinary typecheck is meaningful again.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The contract sheet had one field, "Merkmale", holding whatever applied,
comma-separated — and a dash when nothing did. Two problems in one row.
A dash cannot distinguish "has no company car" from "nobody ever
answered the question", and the entry read "Dienstwagen" without saying
which kind, which is the thing worth knowing since electric vehicles are
tracked separately.
Betriebsrat, Dienstwagen, laterale Führung and C-Level are now four
lines like every other line on the sheet, each with Ja or Nein. The
company car shows its drivetrain instead: E-KFZ or Verbrenner.
That label existed in three places — the dropdown, the hire summary and
now here. It lives in lib/dienstwagen.ts, so the same car cannot end up
named differently depending on which screen you are looking at.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A round of interface corrections from use, plus one schema change behind
them.
The private email address is now optional. It was NOT NULL — the wrong
default for a private detail: someone without one had to invent one, and
invented data in a personnel file is worse than missing data. Both fields
are relabelled to say whose they are, "Private E-Mail" and "Private
Telefonnummer", because the company address does not exist until the person
starts. Uniqueness stays; several NULLs coexist in a Postgres unique index,
which is exactly what is wanted.
The summary step still promised that "Personalnummer und
Firmen-E-Mail-Adresse werden automatisch vergeben". Neither is true any
more. Removed rather than reworded — the step lists what was entered, and a
banner claiming otherwise is worse than no banner.
Dependents move into the wizard as step three, optional. They can only be
attached after the hire, because add_employee_dependent needs an id that
does not exist while the form is open, so they are collected in the draft
and written afterwards. That puts them outside the transaction the person is
created in: if one fails the person still exists, so the message names who
is missing instead of failing silently, and the SV number is checked in the
step rather than after.
The emergency contact gets its own step, second to last, and its
relationship is a dropdown of the common ones rather than free text —
otherwise "Gattin", "Ehefrau" and "Frau" end up side by side and nothing can
be counted. "Sonstige" is there because a closed list would otherwise be
presumptuous.
On the master-data tab it now sits below the dependents rather than above:
both are people around the employee, and this is the one you reach for in a
hurry.
Returning from a long absence: the choice read "unverändert", which made you
open the file to find out what you were agreeing to. It now reads "Wie vor
Abwesenheit (38,5 h)" with the hours actually worked, and the alternative is
"Reduziert" — whose hours field starts empty on purpose. A number already
filled in gets confirmed rather than read off the agreement it comes from.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Three requests from use, one of which changes the schema's mind about
something.
The personnel number is no longer issued. It was GENERATED ALWAYS AS
IDENTITY, which refuses a supplied value outright — but it has to match Loga
and Interflex, and a number this application invents is unknown there, so the
same person ends up with two. Identity dropped, entered everywhere instead:
in the wizard, in the import, and validated against a duplicate with a
message that names the number.
Worth stating plainly: the column had no unique constraint. The identity
prevented collisions as a side effect, and once the value comes from outside
that side effect is gone. The constraint is the point now, and it was
missing.
Company cars distinguish Verbrenner from Elektro, tied to has_dienstwagen by
a CHECK so "E-KFZ" cannot appear against someone without a car. The list
filters on it — with, without, only electric, only combustion — which is the
question the report was really about; it was answerable before only through
an export and manual work.
Emergency contact is name, phone and relationship. Relationship stays free
text: the examples given — Gattin/Gatte, Schwester/Bruder, Freund — are not
a list that closes without telling someone their arrangement does not count.
Name and phone are all-or-nothing, in the database and in both forms: a name
without a number helps nobody, a number without a name does not say who
answers.
Two mistakes of mine on the way, both caught by checks I had written into
the migrations rather than by me:
- The first CHECK on the car type would have permitted exactly the case it
was written against. `art in (…)` yields NULL rather than false when the
column is null, and a CHECK counts NULL as satisfied. It needs an
explicit `is not null` in front.
- The constraint was added before the backfill, so it rejected every
existing row with a car.
Existing cars are recorded as Verbrenner, which is an assumption — but a
visible one: "Elektro" appears nowhere nobody confirmed it.
hire_employee and change_employee_data both had to learn the new columns.
They name their columns one by one, and what is missing there is dropped in
silence — the interface would have collected the fields and thrown them
away, which is what happened to the email address this morning.
Verified against the live database, all rolled back: a hire without a number
is refused, a duplicate is refused naming it, a freely chosen one goes
through; E-KFZ plus contact arrive intact; a contact without a phone is
refused. A change records both, with before and after in the audit detail.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Data model
- employee_assignments records org placement over time (valid_from/valid_to),
written by a trigger on `employees` rather than inside each RPC: ~70
`update employees` statements spread over fifteen migrations mean per-call
bookkeeping would miss paths today and again with every future RPC. A
partial unique index enforces the one-open-interval invariant the trigger
relies on when closing the current row.
- The Organigramm gains a Stichtag (default today). Membership comes from
entry/exit/karenz, past placement from the new history, future placement
projected from pending_org_changes. Placements predating the migration are
backfilled with today's values and flagged as such in the UI, since
employee_history only ever stored free text and cannot be reconstructed.
Correctness
- Reports and exports silently truncated at PostgREST's 1000-row cap
(db.max_rows); employee_history is already past it at ~800 staff. Every
whole-table read now pages explicitly.
- XLSX date cells were a day early: ExcelJS converts a Date to an Excel
serial straight off getTime(), so a Date built at local midnight lands on
the previous day's serial in any positive-offset zone.
- Date handling is pinned to Europe/Vienna throughout, and date-only strings
are formatted without a Date round-trip. The dashboard's YTD window was
built by round-tripping a local Date through toISOString(), which shifted
it a day early and dropped 31 December entirely.
- Export routes parsed measure/group/split/eventType with unchecked `as`
casts, so an unknown value reached column headers as `undefined` and the
Content-Disposition filename. Parsed against the label maps now, with the
filename slugged as a backstop.
- toXlsx keyed columns by header text, silently dropping the second of any
two columns sharing a name — split columns take their header from data.
- The org chart tree walks had no cycle guard; nothing in the schema forbids
a manager_id cycle, and one would hang the tab rather than misreport.
- The login page reflected ?error= verbatim, letting anyone put arbitrary
text on the real sign-in screen; messages are looked up by code now.
- React Flow needs elementsSelectable on, or it sets pointer-events:none on
the whole node and the expand control stops responding.
UI
- Mobile: the shell was unusable below lg — a fixed 236px margin pushed
content off-screen with no mobile navigation at all. The sidebar is now a
drawer, dvh replaces vh, safe-area insets are honoured, inputs are 16px so
iOS stops zooming on focus, and form grids stack.
- Org chart nodes redesigned: per-kind accent stripes and icons, vacant
roles called out, expand control moved to the bottom edge carrying the
child count.
- Pagination is windowed; it previously rendered one link per page (54 for
the employee list, unbounded for the audit log).
- Positions page reduced to open positions with a single "Besetzen" action.
- The employee Organisation tab links into the org chart focused on that
person, reusing the chart's existing search-match highlighting.
Also included, uncommitted until now
- Dependants, HR notes, academic titles, split address fields, position
validity and role/employment fields, with their migrations and UI.
- Docker/compose deployment setup, data-model and security-review docs.
Reworks the app from a two-role (hr_admin/manager) model to a single
HR-only role gated by profiles.is_active, fixes transfer/promote/karenz/
reorg RPCs to actually defer future-dated changes via a new
pending_org_changes table instead of writing them immediately (applied
by a daily Vercel Cron route), makes reorg undo append-only instead of
deleting history, adds Karenz-return and history-date integrity guards,
deprecates the salary column, and adds explicit schema grants + perf
indexes needed to run against a fresh (non-hosted) Postgres instance.
Adds vitest unit + integration test suites (the latter against a real
local Supabase instance) covering all of the above, plus lint/typecheck/
build wiring (`npm run check`).
- components/hire/: 4-step Hire Wizard (Person/Position/Vertrag/
Zusammenfassung) matching sec4.4, with a HireWizardProvider context so it
can be opened both from the global "+ Neueinstellung" button and from a
"Fortsetzen" link on a saved draft.
- actions/hireDrafts.ts: save/delete hire_drafts (owner-scoped RLS already
in place from Phase 1). Dashboard now shows the "Entwuerfe" card the
Phase 1 plan deferred, since the wizard it depends on now exists.
- lib/positions.ts: shared open-positions loader (position number, org
breadcrumb, resolved manager name) used by both the wizard and (later)
the Positions page.
Two real bugs found via live testing and fixed in supabase/functions.sql:
1. hire_employee/rehire_employee: a two-branch CASE returning bare string
literals defaults to `text`, not the target enum, so `status = case
when ... then 'Geplant' else 'Aktiv' end` failed against the
employment_status column. Fixed with an explicit ::employment_status
cast on the whole CASE expression.
2. Postgres precedence gotcha: ->> and || sit at the *same* precedence
tier and left-associate, so `payload->>'first_name' || ' ' ||
payload->>'last_name'` does not group the way it reads - it tries to
apply ->> to an intermediate text value and fails with "operator does
not exist: text ->> unknown". Fixed by parenthesizing every ->>'...'
expression that participates in a || chain.
Also fixed: hire_employee referenced v_position.title outside the branch
that assigns v_position, raising "record not assigned" whenever a hire
wasn't tied to a position_id; extracted a v_job_title variable instead.
Verified live end-to-end: wizard search -> select position -> submit
creates the employee, closes the position, and writes matching
employee_history + audit_log rows atomically.