Files
alpenwerk-hr/components/hire/types.ts
Maximilian Stubhan 901c5c426e Consolidation pass: HR-only access, effective-dated mutations, data integrity guards, test suite
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`).
2026-07-14 20:32:20 +02:00

43 lines
1.1 KiB
TypeScript

import type { ContractType, EmploymentType, GenderType, PaygradeType } from "@/lib/supabase/types";
// The spec's hire wizard field list (§4.4) omits Geschlecht and Standort even
// though both are NOT NULL on employees — added here (defaults keep them
// effectively "free" for the user, same treatment as the karenz-start gap).
export type HireDraftData = {
firstName: string;
lastName: string;
gender: GenderType;
birthDate: string;
svNummer: string;
email: string;
phone: string;
locationId: string;
positionId: string;
besetzung: "Intern" | "Extern" | "";
entryDate: string;
contractType: ContractType;
contractEndDate: string;
employmentType: EmploymentType;
weeklyHours: string;
paygrade: PaygradeType;
};
export const EMPTY_HIRE_DRAFT: HireDraftData = {
firstName: "",
lastName: "",
gender: "m",
birthDate: "",
svNummer: "",
email: "",
phone: "",
locationId: "",
positionId: "",
besetzung: "",
entryDate: "",
contractType: "unbefristet",
contractEndDate: "",
employmentType: "Vollzeit",
weeklyHours: "38.5",
paygrade: "B",
};