Uebergabe-Bereinigung: Kommentare, Geheimnisse, CSP, Dokumentation
Kommentare beschreiben den heutigen Stand und warum er so ist, nicht mehr die Entwicklungsgeschichte: keine Datumsangaben zu Ereignissen, keine Vorfaelle an Testpersonen, keine Lieferantensicht, keine internen Namen oder Plattformen. In Migrationen nur Kommentare ausserhalb von Dollar-Quoting; Kommentare in Funktionskoerpern nur dort, wo ihr Text in keiner anderen Migration als Anker vorkommt. - Andreis Anpassungen aus windows-uebergabe nach master uebernommen. - LOLYO-Startpasswort kommt aus LOLYO_STARTPASSWORT statt aus dem Code; ohne Wert lehnt der Export mit Hinweis ab. - Beispiel- und erzeugte E-Mail-Adressen ohne Kundendomain. - Content-Security-Policy wird durchgesetzt; form-action fest mit login.microsoftonline.com, weil das Paket ohne Umgebungswerte gebaut wird. Geprueft im Browser: alle Seiten ohne Verstoss, Weiterleitung zu Microsoft geht durch. - migrate.mjs: einmalige Uebernahme der alten Buchfuehrung entfernt (seit 20260907100000 ohne Wirkung). - freischalten.ps1 vergibt und entzieht den HR-Zugang (-Entziehen) und protokolliert beides im Audit-Log. - docs/security-review.md -> docs/sicherheitskonzept.md: beschreibt den heutigen Stand ohne offene Punkte. README, entra-sso.md und deploy/windows/README.md ohne Widersprueche (Leserolle der IT, Freischaltung, Konto des Nachtlaufs), Abnahme-Checkliste statt "noch offen". Geprueft: lint, tsc, types:check, 823 Unit-Tests, Waechter (412 Dateien, keine Funde), alle 114 Migrationen auf leerem PostgreSQL 18 (zweiter Lauf leer), rauchtest.sql und vertragsangaben.sql bestanden.
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
-- Alpenwerk HR — initial schema
|
||||
--
|
||||
-- Based on spec §3, with the following corrections
|
||||
-- (see the Phase 1 plan for the full rationale):
|
||||
-- - gender_type restricted to m/w (spec's domain rules exclude "divers")
|
||||
-- - employees.location replaced by a locations reference table + location_id FK
|
||||
-- (the spec's own CHECK listed Wien/Linz/Graz, which contradicts §2's real site list)
|
||||
-- - nationality constrained to the picklist named in §2
|
||||
-- - added: locations, profiles (role-based access), employees_directory (salary-masked view)
|
||||
-- - added: address/address_country/contract_end_date columns (required by §4.5's "Daten ändern"
|
||||
-- panel and the befristet/"Befristet bis" rule, but missing from §3's literal table)
|
||||
-- - added: 'Stammdatenänderung' history event type (required by §4.5, missing from §3's enum)
|
||||
-- - added: reorg_scenarios.undo_snapshot jsonb (required by §4.7's undo feature)
|
||||
-- - added: position number generation + org-unit auto-derivation as real functions/triggers
|
||||
-- Design notes:
|
||||
-- - gender_type restricted to m/w (the domain rules exclude "divers")
|
||||
-- - employees.location is a locations reference table + location_id FK,
|
||||
-- so every site is tied to a country
|
||||
-- - nationality constrained to a fixed picklist
|
||||
-- - locations, profiles (role-based access), employees_directory (salary-masked view)
|
||||
-- - address/address_country/contract_end_date columns, used by the "Daten ändern"
|
||||
-- panel and the befristet/"Befristet bis" rule
|
||||
-- - 'Stammdatenänderung' history event type, used by "Daten ändern"
|
||||
-- - reorg_scenarios.undo_snapshot jsonb, used by the reorg undo feature
|
||||
-- - position number generation + org-unit auto-derivation as real functions/triggers
|
||||
|
||||
create extension if not exists "pgcrypto";
|
||||
|
||||
@@ -37,14 +36,14 @@ create table teams ( -- "Team", numbers 22xxxxxx
|
||||
);
|
||||
|
||||
-- ── Locations (site ties to a country; country picklist drives the UI's
|
||||
-- "select country auto-selects its locations" rule from §2) ─────────
|
||||
-- "select country auto-selects its locations" rule) ─────────
|
||||
create table locations (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
name text not null unique, -- Wien-Hernals, Wolkersdorf, Köln, Brünn, Ljubljana
|
||||
country text not null check (country in ('Österreich', 'Deutschland', 'Tschechien', 'Slowenien'))
|
||||
);
|
||||
|
||||
-- ── Profiles (role-based access per §6) ─────────────────────
|
||||
-- ── Profiles (role-based access) ────────────────────────────
|
||||
create table profiles (
|
||||
id uuid primary key references auth.users(id) on delete cascade,
|
||||
email text not null,
|
||||
@@ -199,7 +198,7 @@ create table reorg_moves (
|
||||
-- ── Functions & triggers ─────────────────────────────────────
|
||||
|
||||
-- Auto-derive division_id from team_id (keeps the denormalized division in sync
|
||||
-- with the team's real parent chain; §3's closing instruction).
|
||||
-- with the team's real parent chain).
|
||||
create or replace function fn_set_employee_org_unit()
|
||||
returns trigger
|
||||
language plpgsql
|
||||
@@ -250,7 +249,7 @@ create trigger trg_employees_touch_updated_at
|
||||
before update on employees
|
||||
for each row execute function fn_touch_updated_at();
|
||||
|
||||
-- Unique 8-digit position numbers starting with '6' (§2).
|
||||
-- Unique 8-digit position numbers starting with '6'.
|
||||
create or replace function generate_position_number()
|
||||
returns text
|
||||
language plpgsql
|
||||
@@ -281,7 +280,7 @@ as $$
|
||||
);
|
||||
$$;
|
||||
|
||||
-- ── Salary-masked read view for the manager role (§6) ────────
|
||||
-- ── Salary-masked read view for the manager role ─────────────
|
||||
-- Owned by the migration role (postgres), which bypasses RLS on the base
|
||||
-- table, so this view is reachable by both roles while column-masking
|
||||
-- salary per session via is_hr_admin().
|
||||
|
||||
Reference in New Issue
Block a user