TeamVis Self-Host-Bundle v0.31.0
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
-- Voranmeldung von Besuchern.
|
||||
-- ====================================================================
|
||||
-- Mitarbeiter koennen im Self-Service-Portal vorab Besucher anmelden,
|
||||
-- bevor diese am Empfang erscheinen. Am Empfangs-Tablet gibt es dann
|
||||
-- eine "Erwartet"-Liste mit Ein-Klick-Eintragen — der Lead-Insert
|
||||
-- erfolgt automatisch, Tipparbeit am Tresen entfaellt.
|
||||
--
|
||||
-- Lifecycle:
|
||||
-- pending → wartet auf Eintreffen
|
||||
-- arrived → wurde am Empfang erfasst (lead_id verknuepft)
|
||||
-- expired → war 24h nach erwarteter Zeit nicht da
|
||||
-- cancelled → vom MA storniert
|
||||
|
||||
create table if not exists public.visitor_preregistrations (
|
||||
id uuid primary key default gen_random_uuid(),
|
||||
-- MA der die Voranmeldung erstellt hat
|
||||
employee_id uuid not null references public.employees(id) on delete cascade,
|
||||
-- Daten des erwarteten Besuchers
|
||||
visitor_first_name text not null,
|
||||
visitor_last_name text not null,
|
||||
visitor_company text,
|
||||
visitor_email text,
|
||||
visitor_phone text,
|
||||
reason text,
|
||||
-- Erwarteter Termin (kann null sein bei "irgendwann heute")
|
||||
expected_at timestamptz,
|
||||
-- Lifecycle
|
||||
status text not null default 'pending'
|
||||
check (status in ('pending', 'arrived', 'expired', 'cancelled')),
|
||||
-- Bei status='arrived' Verknuepfung zum entstandenen Lead
|
||||
arrived_lead_id uuid references public.card_leads(id) on delete set null,
|
||||
created_at timestamptz not null default now(),
|
||||
updated_at timestamptz not null default now()
|
||||
);
|
||||
|
||||
create index if not exists visitor_preregistrations_employee_idx
|
||||
on public.visitor_preregistrations (employee_id, created_at desc);
|
||||
|
||||
-- Index fuer "heute pending" im Empfang-Tablet
|
||||
create index if not exists visitor_preregistrations_pending_idx
|
||||
on public.visitor_preregistrations (expected_at)
|
||||
where status = 'pending';
|
||||
|
||||
alter table public.visitor_preregistrations enable row level security;
|
||||
-- Default deny — Zugriff ueber Service-Role (Admin + Kiosk).
|
||||
Reference in New Issue
Block a user