Compare commits

...
33 Commits
Author SHA1 Message Date
raffaelandClaude Opus 5.5 b4582828b3 chore(infra): Gitea-Host auf git.hg-int.dev umstellen
deploy / deploy (push) Successful in 1m39s
ci / quality (push) Failing after 1m44s
ci / build (push) Skipped
Gitea läuft seit 2026-11-11 auf hivegrid-control (git.hg-int.dev);
git.tool-ctrl.de wird abgeschaltet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:53:16 +01:00
dejanandClaude Fable 5 94faf5e41f Anwesenheit: Fallback-Anker erster Zeiteintrag bei Auto-Tagen
ci / quality (push) Failing after 38s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 1m1s
Auto-Tage vom 6-Uhr-Schnitt haben keinen echten Lock-in — statt die
Anwesenheit ganz auszublenden, ankert sie jetzt am ersten Zeiteintrag
des Tages. teamToday/listToday liefern presenceStartedAt/presenceEndedAt
(echter Check-in hat Vorrang); Team-Karte, Heute-Balken und "Zeit heute"
nutzen die neuen Felder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:20:18 +02:00
dejanandClaude Fable 5 e049e0a88c Anwesenheit ignoriert Auto-Check-in vom 6-Uhr-Schnitt
ci / quality (push) Failing after 46s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 1m30s
Der 6-Uhr-Schnitt legt Folgetage mit checkedInAt=06:00 an — das ist kein
echter Lock-in, die Anwesenheitsanzeige lief dadurch fälschlich seit
06:00 mit (z. B. "6h 6m" mittags trotz spätem Arbeitsbeginn). Neues Flag
day_entry.auto_checked_in (Backfill: bestehende 06:00:00-Check-ins);
teamToday, Heute-Balken und "Zeit heute" zeigen Anwesenheit nur noch bei
echtem Check-in.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 12:13:57 +02:00
dejanandClaude Fable 5 e0fbc386fa Anwesenheit auch in "Zeit im Team heute" anzeigen
ci / quality (push) Failing after 30s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 53s
teamToday liefert pro Person checkedInAt/checkedOutAt aus dem heutigen
day_entry mit; die Team-Karte zeigt daneben "Anwesend: …" (live, bzw.
eingefroren nach Feierabend). Reine Anzeige, kein Eingriff ins Tracking.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 19:28:29 +02:00
dejanandClaude Fable 5 687325ad0d Anwesenheitszeit (Lock-in bis Feierabend) als reine Anzeige ergänzen
ci / quality (push) Failing after 36s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 1m19s
Neben der getrackten Task-Zeit zeigt der "Zeit heute"-Header jetzt
"Getrackt · Anwesend"; der Check-In/Out-Balken zeigt die Anwesenheit
live ("anwesend seit …") und nach Check-Out die finale Dauer. Kein
Eingriff ins Task-Tracking — Wert wird nur aus checkedInAt/checkedOutAt
berechnet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 19:24:56 +02:00
Raffael SheikhandClaude Opus 4.8 a1cf6f3883 chore(format): Prettier über das gesamte Repo
ci / quality (push) Failing after 45s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 53s
Behebt die rote CI (format:check schlug an 36 Alt-Bestand-Dateien fehl:
migrations/meta-Snapshots, seed.ts, schemas/lead.ts, README u. a.) und erzwingt
nebenbei einen frischen web-Build beim Auto-Deploy (apps/web-Dateien geaendert
-> COPY-Layer invalidiert -> Vite baut neu).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 17:50:07 +02:00
Raffael SheikhandClaude Opus 4.8 b340b45110 Historie: nachträglich reflektieren bis 3 Tage nach dem Tag
ci / quality (push) Failing after 36s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 55s
Reflexion/ToDo-Bearbeitung war nur bis 06:00 des Folgetags moeglich. Jetzt
3-Tage-Nachfrist (isEditableWithinGrace) und ein Bearbeiten-Weg aus der Historie:

- werktag: isEditableWithinGrace(entryDate, now, 3) + Tests
- submitReflection/editTodoTitle: Sperre auf die 3-Tage-Nachfrist gelockert
- neue Query dayEntry.ownForDate(date): eigener Tageseintrag + editable-Flag
- reflexion.tsx liest ?date= und laedt vergangene Tage; Felder werden mit der
  bestehenden Reflexion vorbefuellt
- historie.tsx: "Bearbeiten"-Button am eigenen Eintrag (wenn <= 3 Tage)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 13:13:38 +02:00
Raffael SheikhandClaude Opus 4.8 ccd5c42709 chore(format): Prettier auf werktag.ts anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor isEditableWithinGrace.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 13:11:13 +02:00
Raffael SheikhandClaude Opus 4.8 6acf9977ec Historie: Task-Notizen + Link sichtbar, Navigation zu Tagen mit Einträgen
- Notizfeld pro Task in der Reflexion (optional, jeder Status) — nutzt das
  bestehende dropReason-Feld (Limit 200->500). Wird in der Historie bei JEDEM
  Status angezeigt (bisher nur bei "verworfen").
- Optionaler Tages-Link wird in der Historie jetzt angezeigt.
- Historie-Pfeile springen zum naechsten/vorherigen Tag MIT Eintraegen statt
  starr ueber Werktage — Wochenend-Arbeit (z. B. Sa 6.6.) ist nun erreichbar.
  Default-Tag = juengster Tag vor heute mit Eintrag.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 13:04:52 +02:00
Raffael SheikhandClaude Opus 4.8 6e7a910ed3 chore(format): Prettier auf historie.tsx anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor den Historie-Aenderungen.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 13:03:18 +02:00
Raffael SheikhandClaude Opus 4.8 62945201b1 Feature: Lessons-Learned-Vorlage beim Projekt-Abschluss
Der Abschluss verlangte eine URL + freie Vermerk-Textarea, half aber nicht beim
Strukturieren der Retro. Jetzt gefuehrte Felder (Ziel erreicht? / Aufwand vs.
Plan / was lief gut / was nicht), gespeichert als JSONB project.lessons_learned
(Migration 0018). Anzeige im Projekt-Detail als "Retrospektive"; Altprojekte
fallen auf den freien Abschlussvermerk zurueck.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:45:19 +02:00
Raffael SheikhandClaude Opus 4.8 3e66ba3156 chore(format): Prettier auf schema.ts anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor dem lessonsLearned-Feld.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:44:27 +02:00
Raffael SheikhandClaude Opus 4.8 7a7cc75dd6 Feature: „Meine Woche" — persönliche 7-Tage-Übersicht
Alle Bausteine waren da (Ampel/Trend, ToDo-Status, Anwesenheit), aber niemand
sah je seinen eigenen Verlauf. Neue Query dayEntry.myWeek + Route /meine-woche
(pro Tag Ampel, Antritt→Feierabend, ToDo-Zähler). Nav-Tab „Woche" + Shortcut g w.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:39:09 +02:00
Raffael SheikhandClaude Opus 4.8 4311eadf50 chore(format): Prettier auf day-entry.ts + TopNav.tsx anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor der myWeek-Query und
dem Woche-Nav-Tab.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:37:59 +02:00
Raffael SheikhandClaude Opus 4.8 a0a2392e3d Feature: Globale Schnellsuche (Cmd/Ctrl+K oder „/")
Keine Sprung-zu-Suche bei wachsender Projekt-/Lead-Zahl. Neuer search-Router
(ILIKE ueber Projekte, Leads, offene Blocker) + Command-Palette ueber die
Modal-Basis, getriggert per Cmd/Ctrl+K oder „/". Klick springt zum Ziel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:34:25 +02:00
Raffael SheikhandClaude Opus 4.8 aad247dd4a Feature: Deal-Pipeline-UI (totes Deal-Backend reaktiviert)
Das vollstaendige Deal-Backend (list/kpis/updateStage) lag ohne UI brach;
Lead->Deal-Promotion war eine Sackgasse. Neue Route /pipeline: KPI-Header
(gewichtete Pipeline, offene Deals, gewonnen/Quartal) + Spalten je Stufe
(lead/erstgespraech/demo/angebot/abschluss), Stufenwechsel per Select
(deal.updateStage). Verlinkt von /leads. Kein Drag-Kanban (CONVENTIONS).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:27:54 +02:00
Raffael SheikhandClaude Opus 4.8 6a25383cbe chore(format): Prettier auf router.tsx anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor der Pipeline-Route.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:27:14 +02:00
Raffael SheikhandClaude Opus 4.8 23e850287c Feature: Fällige Lead-Wiedervorlagen auf der Leads-Seite
naechsterSchrittDatum wurde erfasst, aber nie als faellige Liste geb√ºndelt —
warme Leads gingen unter. Neue Query lead.dueFollowUps (aktive Leads mit
faelligem/ueberfaelligem naechsten Schritt) + "Faellige Wiedervorlagen"-Block
oben auf /leads.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:19:13 +02:00
Raffael SheikhandClaude Opus 4.8 3d9b739d25 chore(format): Prettier auf lead.ts anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor der dueFollowUps-Query.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:18:25 +02:00
Raffael SheikhandClaude Opus 4.8 7dd1f2fb20 Feature: Zeit-pro-Projekt-Auswertung im Projekt-Detail
time_entry erfasst bezugKind='project'+bezugId, aber niemand sah je, wie viel
Zeit ein Projekt frisst. Neue Query time.byProject (Gesamtsumme + pro Person);
neue "Getrackte Zeit"-Sektion im Projekt-Detail (blendet sich aus, wenn nichts
getrackt wurde).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:15:05 +02:00
Raffael SheikhandClaude Opus 4.8 2eef94afce chore(format): Prettier auf time.ts anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor der byProject-Query.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:14:31 +02:00
Raffael SheikhandClaude Opus 4.8 c98d27e70c api: Audit-Log verdrahtet (auditedProcedure an kritische Mutationen)
withAudit war als tRPC-Wrapper definiert, aber an keine Procedure gehaengt
(audit_event blieb leer). Jetzt eine echte tRPC-v11-Middleware-Procedure
(auditedProcedure), die nach erfolgreicher Mutation best-effort einen
audit_event schreibt (Fehler beim Audit kippen die Mutation nicht).

Verdrahtet an die folgenreichen Zustandsuebergaenge:
- blocker.resolve
- project.archive, project.setPhase, project.addPhaseGate

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:06:13 +02:00
Raffael SheikhandClaude Opus 4.8 6e7f639013 chore(format): Prettier auf project.ts anwenden
Alt-Bestand nie formatiert — isolierter Format-Lauf vor der Audit-Verdrahtung.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:05:26 +02:00
Raffael SheikhandClaude Opus 4.8 9bae1702aa db: Foreign Keys für blocker- und Tageseintrag-Verweise (Migration 0017)
Bisher reine uuid-Spalten ohne referenzielle Integritaet -> Orphan-Risiko, wenn
das Ziel geloescht wird. Jetzt echte FKs mit ON DELETE SET NULL:

- day_entry.blocker_id -> blocker
- blocker.area_id -> area
- blocker.project_id -> project

Migration bereinigt vorab verwaiste IDs (UPDATE ... SET NULL), damit ADD
CONSTRAINT auf Altdaten nicht bricht. Verifiziert: alle 18 Migrationen laufen
gegen frische Postgres 16 durch, FKs angelegt.

(todo.bezug_id / time_entry.bezug_id bleiben FK-frei: echt polymorph ueber
bezug_kind project/deal/campaign — kein einzelner FK moeglich.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 12:01:24 +02:00
Raffael SheikhandClaude Opus 4.8 ff0a15b94e UI: Touch-Sichtbarkeit der Hover-Aktionen
Edit/Delete/Start/Zeit-Buttons waren nur per group-hover sichtbar (opacity-0)
und damit auf Touch-Geraeten unerreichbar. Jetzt mobil dauerhaft sichtbar, ab
sm (Desktop) weiterhin Hover-Reveal.

- TimelineSection (Bearbeiten/Loeschen einer Zeit-Zeile)
- heute (Task starten/fortsetzen, Zeit nachtragen)
- reflexion (ToDo-Titel bearbeiten)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:50:54 +02:00
Raffael SheikhandClaude Opus 4.8 f600c9f187 UI: alle 8 Dialoge auf barrierearme Modal-Basis umgestellt
Bisher waren alle Overlay-Dialoge plain divs ohne role/Fokus-Trap/Escape.
Jetzt setzen sie auf <Modal> auf (role=dialog, aria-modal, Fokus-Trap +
-Rueckgabe, Escape, Body-Scroll-Lock, konsistenter X-Button, Scroll bei langem
Inhalt).

- Modal: X-Schliessen-Button + max-h-[90vh]/overflow-y-auto ergaenzt
- BlockerDialog, ManualDialog (Timeline)
- leads: CSV-Import + Neuer Lead
- bereich: Neues Projekt
- projekt: Gate-Review + Projekt abschliessen
- lead: Zu Deal machen

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:49:05 +02:00
Raffael SheikhandClaude Opus 4.8 30006e3b32 chore(format): Prettier auf B4-Zieldateien anwenden
Vorbereitung der Modal-Umstellung: TimelineSection/leads/bereich (Alt-Bestand
nie formatiert) + kleiner B3-Nachzug in projekt/lead. Reine Formatierung, damit
die folgenden Modal-Commits nur echte Aenderungen zeigen.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:38:40 +02:00
Raffael SheikhandClaude Opus 4.8 8b0df9cc4e UI: Fehler-States statt weißer Leerseiten bei Query-Fehlern
Dashboard/Projekt/Lead/Team/Historie rendern bei fehlgeschlagener Query nicht
mehr ein stilles `return null` (leere weisse Seite), sondern einen Hinweis mit
"Neu laden"-Button.

- Neue Komponente ErrorState (Meldung + optionaler Retry)
- 5 Routen: if (q.isError || !q.data) -> ErrorState mit q.refetch()

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:35:52 +02:00
Raffael SheikhandClaude Opus 4.8 90caa282ee UI: Bestätigungsdialog vor allen Löschungen (Projekt + Lead)
Bisher loeschten 8 Muelltonnen-Icons sofort und unwiderruflich, ganz ohne
Rueckfrage. Jetzt fragt jeder Loeschpfad ueber useConfirm() nach.

- projekt.tsx: Aenderung, Stakeholder, Risiko, Meilenstein
- lead.tsx: Kontakt, Touchpoint, offene Frage, Anhang

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:28:48 +02:00
Raffael SheikhandClaude Opus 4.8 33a740ca7e chore(format): Prettier auf heute/projekt/lead.tsx anwenden
Diese drei Dateien waren nicht prettier-konform (nie formatiert). Isolierter
Format-Lauf, damit der folgende Logik-Commit nur die echten Aenderungen zeigt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:28:19 +02:00
Raffael SheikhandClaude Opus 4.8 00b611fa3b UI: Modal-Basis + Confirm-Infrastruktur + Feierabend-Tagesabschluss
Fundament für Paket B (UI/UX-Härtung):
- Modal: barrierearmer Basis-Dialog (role/aria-modal, Fokus-Trap, Escape,
  Fokus-Rückgabe, Body-Scroll-Lock, Portal). Basis für alle App-Dialoge.
- ConfirmProvider/useConfirm: imperative Bestaetigung (await confirm({...}))
  statt window.confirm(); wird als Naechstes an die Loeschpfade gehaengt.
- Feierabend-Dialog: Tagesabschluss mit Zusammenfassung (erledigt/offen/
  verworfen) + Hinweis auf offene/unreflektierte ToDos und fehlende Reflexion.
  Check-Out feuert erst nach Bestaetigung; bleibt reversibel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:19:40 +02:00
Raffael SheikhandClaude Opus 4.8 7285ed9cae Backup-Sidecar: täglicher pg_dump scharf geschaltet
Das dokumentierte Backup lief real nie (stock postgres-Image ohne Cron,
backup.sh nirgends eingebunden) -> bei Volume-/Disk-Verlust drohte Totalverlust.

- Neuer service "backup" (docker-compose.yml): postgres:16-alpine als Sidecar,
  taeglicher pg_dump um BACKUP_HOUR (Default 03:00 Europe/Berlin)
- backup-loop.sh: abhaengigkeitsfreier Tages-Scheduler (umgeht busybox-cron-
  Environment-Eigenheiten)
- backup.sh korrigiert: laeuft remote gegen PGHOST mit PGPASSWORD; -Fc statt
  "-Fc | gzip" (war doppelt komprimiert und als .sql.gz nicht restore-bar) -> .dump
- BACKUP_HOUR/BACKUP_RETENTION_DAYS konfigurierbar (.env.example)
- operations.md: Backup-/Restore-Anleitung an Ist-Zustand angepasst

Verifiziert: pg_dump erstellt + pg_restore in frische DB, Daten intakt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 11:09:38 +02:00
Raffael SheikhandClaude Opus 4.8 39e259f3ac Arbeitstag-Grenze auf 6 Uhr + Feierabend reversibel
Nachtarbeit über Mitternacht brach bisher den Check-Out ("Du bist heute
noch nicht locked in") und sperrte nach versehentlichem Feierabend den Tag.

- Tag = Kalendertag des Check-ins; eine über Mitternacht laufende Session
  zaehlt zum Starttag, bis 06:00 des Folgetags (isWorkdaySealed)
- checkOut/today finden den offenen Eintrag statt stur "heute"
- reopen ("Arbeit fortsetzen") hebt einen Feierabend wieder auf
- applyWorkdayBoundary: nahtloser 6-Uhr-Schnitt (Auto-Checkout + Folge-Tag,
  offene ToDos wandern mit)
- Reflexion/ToDo-Edit folgen der 6-Uhr-Grenze statt Mitternacht
- Cron apply-workday-boundaries fuer Team-Dashboard-Konsistenz

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 10:48:23 +02:00
79 changed files with 13545 additions and 3217 deletions

No files matched your search

+5
View File
@@ -17,6 +17,11 @@ SESSION_COOKIE_SECRET=please-change-me-in-prod-at-least-32-chars
# --- Cron Bearer (Story 2.6 + 5.1 + 6.3) --- # --- Cron Bearer (Story 2.6 + 5.1 + 6.3) ---
CRON_BEARER_TOKEN=please-change-me-in-prod CRON_BEARER_TOKEN=please-change-me-in-prod
# --- Backup-Sidecar (Story 6.3, nur Prod) ---
# Täglicher pg_dump im service "backup". Beide optional (Defaults: 03 / 14).
# BACKUP_HOUR=03
# BACKUP_RETENTION_DAYS=14
# --- App --- # --- App ---
NODE_ENV=development NODE_ENV=development
LOG_LEVEL=info LOG_LEVEL=info
+9 -8
View File
@@ -9,7 +9,7 @@ Internes Web-Tool von **ToolCTRL** für den täglichen Überblick über alle Pro
## Was die App tut ## Was die App tut
| Bereich | Feature | | Bereich | Feature |
|---|---| | ------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Dashboard** (`/dashboard`) | Unternehmens-Übersicht: Bereichs-Ampelstatus, **Showstopper** (offene Showstopper-Risiken), **Projekte in Eskalation/Taskforce**, „Heute fehlt"-Liste, bereichsübergreifende Blocker, Pflicht-Minimum-Übersicht, Jourfixe-Hinweis, „Heute im Team" (ToDos), „Zeit im Team heute" (Live-Tracking, Wall-Clock), Vortags-Feed | | **Dashboard** (`/dashboard`) | Unternehmens-Übersicht: Bereichs-Ampelstatus, **Showstopper** (offene Showstopper-Risiken), **Projekte in Eskalation/Taskforce**, „Heute fehlt"-Liste, bereichsübergreifende Blocker, Pflicht-Minimum-Übersicht, Jourfixe-Hinweis, „Heute im Team" (ToDos), „Zeit im Team heute" (Live-Tracking, Wall-Clock), Vortags-Feed |
| **Bereich** (`/bereich`, `/bereich/<slug>`) | Tab-Switcher Entwicklung / Vertrieb / Marketing — Projekt-Liste (Kundenprojekte / Interne Projekte) mit Pflicht-Minimum- & Modus-Indicator. **Vertrieb** zusätzlich: Lead-Teaser + „Projekte mit Vertriebsaktivität" (bereichsübergreifend) | | **Bereich** (`/bereich`, `/bereich/<slug>`) | Tab-Switcher Entwicklung / Vertrieb / Marketing — Projekt-Liste (Kundenprojekte / Interne Projekte) mit Pflicht-Minimum- & Modus-Indicator. **Vertrieb** zusätzlich: Lead-Teaser + „Projekte mit Vertriebsaktivität" (bereichsübergreifend) |
| **Projekt** (`/projekt/:id`) | Detail: Ziel/Maxime/Nicht-Ziele/Liefergegenstände + Zieldreieck, **Phasen-Lebenszyklus mit Gate-Reviews**, **Statusbericht** (Ampel/Trend + Verlauf), **Stakeholder-Matrix**, **Risiko- & Chancen-Register**, **verknüpfte Leads**, **Änderungs-Log**, Verlinkungen, Pflicht-Minimum, Meilensteine (mit Ergebnis/Kundennutzen + Datums-Warnung), DoD, Projekt-Abschluss (Checkliste + Vermerk, P1), Projekt-Modus | | **Projekt** (`/projekt/:id`) | Detail: Ziel/Maxime/Nicht-Ziele/Liefergegenstände + Zieldreieck, **Phasen-Lebenszyklus mit Gate-Reviews**, **Statusbericht** (Ampel/Trend + Verlauf), **Stakeholder-Matrix**, **Risiko- & Chancen-Register**, **verknüpfte Leads**, **Änderungs-Log**, Verlinkungen, Pflicht-Minimum, Meilensteine (mit Ergebnis/Kundennutzen + Datums-Warnung), DoD, Projekt-Abschluss (Checkliste + Vermerk, P1), Projekt-Modus |
@@ -33,7 +33,7 @@ Internes Web-Tool von **ToolCTRL** für den täglichen Überblick über alle Pro
## Tech Stack ## Tech Stack
| Layer | Wahl | | Layer | Wahl |
|---|---| | ------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Sprache | **TypeScript** strict, ESM überall | | Sprache | **TypeScript** strict, ESM überall |
| Repo-Layout | **pnpm**-Monorepo (`pnpm-workspace.yaml`) | | Repo-Layout | **pnpm**-Monorepo (`pnpm-workspace.yaml`) |
| Node | **22+** | | Node | **22+** |
@@ -154,7 +154,7 @@ Im Dev-Modus läuft ein **Auto-Login** als Admin-User `dejan@tool-ctrl.de`. Auth
### Wichtige Ports ### Wichtige Ports
| Service | Port | Quelle | | Service | Port | Quelle |
|---|---|---| | --------------- | --------- | ------------------------------------------------------------------------- |
| Vite Dev-Server | **7173** | `apps/web/vite.config.ts` | | Vite Dev-Server | **7173** | `apps/web/vite.config.ts` |
| Fastify API | **7100** | `.env` (`PORT`) | | Fastify API | **7100** | `.env` (`PORT`) |
| Postgres (Dev) | **55432** | `docker-compose.dev.yml` (5432 würde mit Mac-System-Postgres kollidieren) | | Postgres (Dev) | **55432** | `docker-compose.dev.yml` (5432 würde mit Mac-System-Postgres kollidieren) |
@@ -179,7 +179,7 @@ Postgres 16, Drizzle als ORM und Migrator. **Schema-Single-Source-of-Truth**: `p
### Tabellen (aktueller Stand nach Migration 0011) ### Tabellen (aktueller Stand nach Migration 0011)
| Tabelle | Zweck | | Tabelle | Zweck |
|---|---| | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `user` | Mitarbeiter (`authentik_sub` als Identitäts-Anker), `is_admin`-Flag | | `user` | Mitarbeiter (`authentik_sub` als Identitäts-Anker), `is_admin`-Flag |
| `session` | Server-Side Sessions (Postgres-persistent), Browser kennt nur Cookie-`id` | | `session` | Server-Side Sessions (Postgres-persistent), Browser kennt nur Cookie-`id` |
| `audit_event` | Audit-Trail (Tabelle vorhanden; `withAudit`-Wrapper aktuell nicht verdrahtet) | | `audit_event` | Audit-Trail (Tabelle vorhanden; `withAudit`-Wrapper aktuell nicht verdrahtet) |
@@ -211,7 +211,7 @@ Migrationen liegen in `packages/db/migrations/*.sql` und werden über `drizzle-k
### REST-Routen (Fastify) ### REST-Routen (Fastify)
| Methode | Pfad | Zweck | | Methode | Pfad | Zweck |
|---|---|---| | ----------- | ----------------------- | ----------------------------------------------------------------------------------------------------------- |
| `GET` | `/api/health` | DB- und Authentik-Reachability-Check | | `GET` | `/api/health` | DB- und Authentik-Reachability-Check |
| `GET` | `/api/me` | Eingeloggter User (oder 401) | | `GET` | `/api/me` | Eingeloggter User (oder 401) |
| `GET` | `/api/auth/login` | Startet OIDC-Flow (Redirect zu Authentik) | | `GET` | `/api/auth/login` | Startet OIDC-Flow (Redirect zu Authentik) |
@@ -360,7 +360,7 @@ Konstanten (`MAX_TODO_TEXT_LENGTH`, `WERKTAGE`, `JOURFIXE_DAY`, `REFLEXION_REMIN
`docker-compose.yml` definiert vier Services: `docker-compose.yml` definiert vier Services:
| Service | Image | Rolle | | Service | Image | Rolle |
|---|---|---| | ---------- | ------------------------------- | ----------------------------------------------------------------------------- |
| `postgres` | `postgres:16-alpine` | DB, persistentes Volume `cockpit_postgres_data`, Backups in `cockpit_backups` | | `postgres` | `postgres:16-alpine` | DB, persistentes Volume `cockpit_postgres_data`, Backups in `cockpit_backups` |
| `api` | Build aus `apps/api/Dockerfile` | Fastify auf 3000, hängt an Postgres-Health | | `api` | Build aus `apps/api/Dockerfile` | Fastify auf 3000, hängt an Postgres-Health |
| `web` | Build aus `apps/web/Dockerfile` | Vite-Build wird in `cockpit_web_dist`-Volume gelegt | | `web` | Build aus `apps/web/Dockerfile` | Vite-Build wird in `cockpit_web_dist`-Volume gelegt |
@@ -392,6 +392,7 @@ build → install, web build, api build (needs quality)
`.gitea/workflows/deploy.yml` (Runner `runs-on: host` auf dem Homeserver): **bei jedem Push auf `main`** → `git reset --hard origin/main`, `docker compose up -d --build`, dann Warten bis `cockpit-api` healthy. Es gibt **keinen manuellen Trigger** — ein (ggf. leerer) Push löst den Deploy aus. `.gitea/workflows/deploy.yml` (Runner `runs-on: host` auf dem Homeserver): **bei jedem Push auf `main`** → `git reset --hard origin/main`, `docker compose up -d --build`, dann Warten bis `cockpit-api` healthy. Es gibt **keinen manuellen Trigger** — ein (ggf. leerer) Push löst den Deploy aus.
**Startup-Verhalten der API** (`apps/api/src/server.ts`): vor dem Listen wird **Startup-Verhalten der API** (`apps/api/src/server.ts`): vor dem Listen wird
1. `runMigrations()` ausgeführt (Drizzle-Migrationen idempotent; schlägt eine fehl, startet die API nicht), dann 1. `runMigrations()` ausgeführt (Drizzle-Migrationen idempotent; schlägt eine fehl, startet die API nicht), dann
2. `ensureBaseAreas()` (legt die 4 Basis-Bereiche idempotent an, damit z. B. der „Neues Projekt"-Dropdown nie leer ist — auch auf einer nicht geseedeten Prod-DB). 2. `ensureBaseAreas()` (legt die 4 Basis-Bereiche idempotent an, damit z. B. der „Neues Projekt"-Dropdown nie leer ist — auch auf einer nicht geseedeten Prod-DB).
@@ -435,7 +436,7 @@ Vollständige PRD/Architektur/UX/Stories im `_bmad-output/planning-artifacts/`-O
- Anti-Ziele und Roadmap-Hinweise - Anti-Ziele und Roadmap-Hinweise
| Datei | Inhalt | | Datei | Inhalt |
|---|---| | ---------------------------------------------- | --------------------------------------- |
| `prds/prd-projectmanagement-2026-05-25/prd.md` | PRD (49 FRs, 16 NFRs) | | `prds/prd-projectmanagement-2026-05-25/prd.md` | PRD (49 FRs, 16 NFRs) |
| `architecture.md` | Stack-Entscheidungen, Patterns | | `architecture.md` | Stack-Entscheidungen, Patterns |
| `ux-design-specification.md` | Brand-Tokens, Komponenten, Voice & Tone | | `ux-design-specification.md` | Brand-Tokens, Komponenten, Voice & Tone |
@@ -446,7 +447,7 @@ Vollständige PRD/Architektur/UX/Stories im `_bmad-output/planning-artifacts/`-O
## Repo & Remote ## Repo & Remote
- **Default-Branch**: `main` - **Default-Branch**: `main`
- **Remote**: `ssh://git@git.tool-ctrl.de:2222/toolctrl-labs/everythingbutwork.git` (Gitea, non-standard SSH-Port) - **Remote**: `ssh://git@git.hg-int.dev:2222/toolctrl-labs/everythingbutwork.git` (Gitea, non-standard SSH-Port)
- **Gitignore**: `.env`, `node_modules`, `dist`, `_bmad/`-Tools (Bmad-Framework), `.claude/`, `ToolCTRL Brand Identity/` (215 MB Raw-Assets) - **Gitignore**: `.env`, `node_modules`, `dist`, `_bmad/`-Tools (Bmad-Framework), `.claude/`, `ToolCTRL Brand Identity/` (215 MB Raw-Assets)
--- ---
+7 -2
View File
@@ -111,13 +111,18 @@ export async function registerAuthRoutes(app: FastifyInstance): Promise<void> {
// die App ohne Authentik durchnavigierbar ist. Authentik kommt in der späteren // die App ohne Authentik durchnavigierbar ist. Authentik kommt in der späteren
// Roadmap. Nur aktiv bei NODE_ENV=development. // Roadmap. Nur aktiv bei NODE_ENV=development.
if (env.NODE_ENV === 'development') { if (env.NODE_ENV === 'development') {
const handler = async (req: import('fastify').FastifyRequest, reply: import('fastify').FastifyReply) => { const handler = async (
req: import('fastify').FastifyRequest,
reply: import('fastify').FastifyReply,
) => {
const { getDb } = await import('../db.js'); const { getDb } = await import('../db.js');
const { user } = await import('@cockpit/db'); const { user } = await import('@cockpit/db');
const { eq } = await import('drizzle-orm'); const { eq } = await import('drizzle-orm');
const { db } = getDb(); const { db } = getDb();
const found = (await db.select().from(user).where(eq(user.email, 'dejan@tool-ctrl.de')).limit(1))[0]; const found = (
await db.select().from(user).where(eq(user.email, 'dejan@tool-ctrl.de')).limit(1)
)[0];
const userRow = found const userRow = found
? found ? found
: await upsertUserFromOidc({ : await upsertUserFromOidc({
+30 -1
View File
@@ -1,8 +1,10 @@
import type { FastifyInstance, FastifyRequest } from 'fastify'; import type { FastifyInstance, FastifyRequest } from 'fastify';
import { isNull } from 'drizzle-orm';
import { dayEntry } from '@cockpit/db';
import { loadEnv } from '../env.js'; import { loadEnv } from '../env.js';
import { logger } from '../lib/logger.js'; import { logger } from '../lib/logger.js';
import { getDb } from '../db.js'; import { getDb } from '../db.js';
import { publishYesterdaysEntries } from '../routers/day-entry.js'; import { publishYesterdaysEntries, applyWorkdayBoundary } from '../routers/day-entry.js';
import { previousWerktag, todayIso } from '../lib/werktag.js'; import { previousWerktag, todayIso } from '../lib/werktag.js';
function authorize(req: FastifyRequest): void { function authorize(req: FastifyRequest): void {
@@ -15,6 +17,33 @@ function authorize(req: FastifyRequest): void {
} }
export async function registerCronRoutes(app: FastifyInstance): Promise<void> { export async function registerCronRoutes(app: FastifyInstance): Promise<void> {
// 6-Uhr-Schnitt teamweit: beendet offene Nacht-Einträge, deren Arbeitstag
// abgelaufen ist, und startet den Folge-Tag. Lazy passiert das ohnehin beim
// nächsten Request der Person — dieser Cron (≈06:05) hält das Team-Dashboard
// konsistent, auch ohne dass die Person aktiv wird.
app.post('/internal/cron/apply-workday-boundaries', async (req, reply) => {
try {
authorize(req);
} catch (err) {
reply.code(401);
logger.warn({ err }, 'unauthorized cron call');
return { error: 'unauthorized' };
}
const { db } = getDb();
const now = new Date();
const openRows = await db
.selectDistinct({ userId: dayEntry.userId })
.from(dayEntry)
.where(isNull(dayEntry.checkedOutAt));
let cut = 0;
for (const { userId } of openRows) {
await applyWorkdayBoundary(db, userId, now);
cut++;
}
logger.info({ usersChecked: cut }, 'applied workday boundaries');
return { ok: true, usersChecked: cut };
});
app.post('/internal/cron/publish-day-entries', async (req, reply) => { app.post('/internal/cron/publish-day-entries', async (req, reply) => {
try { try {
authorize(req); authorize(req);
+4 -1
View File
@@ -47,7 +47,10 @@ async function safeText(res: Response): Promise<string> {
* Startet ein laufendes Timesheet in Kimai (Clock-In). Liefert die Kimai- * Startet ein laufendes Timesheet in Kimai (Clock-In). Liefert die Kimai-
* Timesheet-ID zurück oder null (nicht konfiguriert / Fehler). * Timesheet-ID zurück oder null (nicht konfiguriert / Fehler).
*/ */
export async function kimaiClockIn(opts: { begin: Date; description?: string }): Promise<number | null> { export async function kimaiClockIn(opts: {
begin: Date;
description?: string;
}): Promise<number | null> {
const cfg = kimaiConfig(); const cfg = kimaiConfig();
if (!cfg) { if (!cfg) {
logger.debug('kimai not configured — clock-in skipped'); logger.debug('kimai not configured — clock-in skipped');
+50
View File
@@ -6,6 +6,10 @@ import {
previousWerktag, previousWerktag,
werktageBetween, werktageBetween,
berlinDayStartMs, berlinDayStartMs,
addCalendarDays,
workdayCutoffMs,
isWorkdaySealed,
isEditableWithinGrace,
} from './werktag'; } from './werktag';
describe('werktag', () => { describe('werktag', () => {
@@ -41,4 +45,50 @@ describe('werktag', () => {
// Winter (CET, +1): 00:00 Berlin = 23:00 UTC am Vortag // Winter (CET, +1): 00:00 Berlin = 23:00 UTC am Vortag
expect(berlinDayStartMs('2026-01-15')).toBe(Date.parse('2026-01-14T23:00:00Z')); expect(berlinDayStartMs('2026-01-15')).toBe(Date.parse('2026-01-14T23:00:00Z'));
}); });
it('addCalendarDays verschiebt Kalendertage (auch über Monatsgrenze)', () => {
expect(addCalendarDays('2026-06-07', 1)).toBe('2026-06-08');
expect(addCalendarDays('2026-06-30', 1)).toBe('2026-07-01');
expect(addCalendarDays('2026-06-07', -1)).toBe('2026-06-06');
});
it('workdayCutoffMs ist 06:00 Berlin am Folgetag (DST-korrekt)', () => {
// Sommer (CEST, +2): 06:00 Berlin = 04:00 UTC
expect(workdayCutoffMs('2026-06-06')).toBe(Date.parse('2026-06-07T04:00:00Z'));
// Winter (CET, +1): 06:00 Berlin = 05:00 UTC
expect(workdayCutoffMs('2026-01-15')).toBe(Date.parse('2026-01-16T05:00:00Z'));
});
describe('isWorkdaySealed — der Arbeitstag = Check-in-Kalendertag', () => {
// Eintrag mit Datum Sa 2026-06-06 (Check-in irgendwann an dem Tag).
const entry = '2026-06-06';
it('vor Mitternacht: nicht versiegelt', () => {
expect(isWorkdaySealed(entry, new Date('2026-06-06T22:00:00+02:00'))).toBe(false);
});
it('nach Mitternacht, aber vor 06:00: noch der Arbeitstag (nicht versiegelt)', () => {
// 03:00 in der Nacht → gehört noch zum 06.
expect(isWorkdaySealed(entry, new Date('2026-06-07T03:00:00+02:00'))).toBe(false);
});
it('um/nach 06:00 des Folgetags: versiegelt', () => {
expect(isWorkdaySealed(entry, new Date('2026-06-07T06:00:00+02:00'))).toBe(true);
expect(isWorkdaySealed(entry, new Date('2026-06-07T09:00:00+02:00'))).toBe(true);
});
it('ein nach Mitternacht begonnener Tag (Datum = 07.) gilt um 06:00 noch nicht als versiegelt', () => {
const sameDayStart = '2026-06-07';
expect(isWorkdaySealed(sameDayStart, new Date('2026-06-07T06:00:00+02:00'))).toBe(false);
});
});
describe('isEditableWithinGrace — 3-Tage-Nachfrist', () => {
const entry = '2026-06-05'; // Fr
it('am Eintragstag selbst editierbar', () => {
expect(isEditableWithinGrace(entry, new Date('2026-06-05T20:00:00+02:00'))).toBe(true);
});
it('bis Ende des 3. Tages danach (08.) editierbar', () => {
expect(isEditableWithinGrace(entry, new Date('2026-06-08T23:00:00+02:00'))).toBe(true);
});
it('ab dem 4. Tag (09.) gesperrt', () => {
expect(isEditableWithinGrace(entry, new Date('2026-06-09T00:30:00+02:00'))).toBe(false);
});
});
}); });
+55 -1
View File
@@ -5,6 +5,14 @@ import { isGermanHoliday } from './holidays.js';
const TIMEZONE = 'Europe/Berlin'; const TIMEZONE = 'Europe/Berlin';
/**
* Uhrzeit (Berlin), zu der ein Arbeitstag „kippt": Wer um 06:00 noch eingestempelt
* ist, dessen Tag wird automatisch beendet (siehe `applyWorkdayBoundary`). Bis dahin
* gehört eine über Mitternacht laufende Session noch zum Tag, an dem eingestempelt
* wurde — der Arbeitstag eines Eintrags = der Kalendertag des Check-ins.
*/
export const WORKDAY_RESET_HOUR = 6;
/** /**
* Gibt das aktuelle Datum (oder `now`) als `YYYY-MM-DD` in Europe/Berlin zurück. * Gibt das aktuelle Datum (oder `now`) als `YYYY-MM-DD` in Europe/Berlin zurück.
*/ */
@@ -12,6 +20,45 @@ export function todayIso(now: Date = new Date()): string {
return formatIsoDate(now); return formatIsoDate(now);
} }
/**
* Verschiebt ein ISO-Datum um `n` Kalendertage (nicht Werktage). DST-robust, weil
* `parseIsoDate` von 12:00 UTC ausgeht und in Berlin formatiert wird.
*/
export function addCalendarDays(iso: string, n: number): string {
const d = parseIsoDate(iso);
return formatIsoDate(new Date(d.getTime() + n * 24 * 60 * 60 * 1000));
}
/**
* Epoch-ms des Zeitpunkts, ab dem der Arbeitstag mit Eintrags-Datum `entryDate`
* abgelaufen ist: 06:00 Europe/Berlin am Folgetag (DST-korrekt).
*/
export function workdayCutoffMs(entryDate: string): number {
return berlinDayStartMs(addCalendarDays(entryDate, 1)) + WORKDAY_RESET_HOUR * 60 * 60 * 1000;
}
/**
* True, wenn der Arbeitstag eines Eintrags (Datum = Check-in-Kalendertag) bereits
* „versiegelt" ist, d. h. `now` liegt am/nach 06:00 des Folgetags. Versiegelte Tage
* sind read-only und werden nicht mehr als aktiver Tag angezeigt.
*/
export function isWorkdaySealed(entryDate: string, now: Date = new Date()): boolean {
return now.getTime() >= workdayCutoffMs(entryDate);
}
/**
* True, solange ein Eintrag mit Datum `entryDate` noch nachträglich bearbeitet
* werden darf: bis zum Ende des `graceDays`-ten Kalendertages danach (Default 3).
* Genutzt für die Reflexion in der Historie (Tag selbst + 3 Tage Nachfrist).
*/
export function isEditableWithinGrace(
entryDate: string,
now: Date = new Date(),
graceDays = 3,
): boolean {
return now.getTime() < berlinDayStartMs(addCalendarDays(entryDate, graceDays + 1));
}
export function formatIsoDate(d: Date): string { export function formatIsoDate(d: Date): string {
const fmt = new Intl.DateTimeFormat('en-CA', { const fmt = new Intl.DateTimeFormat('en-CA', {
timeZone: TIMEZONE, timeZone: TIMEZONE,
@@ -40,7 +87,14 @@ export function berlinDayStartMs(iso: string): number {
second: '2-digit', second: '2-digit',
}).formatToParts(new Date(utcMidnight)); }).formatToParts(new Date(utcMidnight));
const get = (t: string) => Number(parts.find((p) => p.type === t)?.value ?? '0'); const get = (t: string) => Number(parts.find((p) => p.type === t)?.value ?? '0');
const asIfUtc = Date.UTC(get('year'), get('month') - 1, get('day'), get('hour'), get('minute'), get('second')); const asIfUtc = Date.UTC(
get('year'),
get('month') - 1,
get('day'),
get('hour'),
get('minute'),
get('second'),
);
const offset = asIfUtc - utcMidnight; // ms, die Berlin der UTC voraus ist const offset = asIfUtc - utcMidnight; // ms, die Berlin der UTC voraus ist
return utcMidnight - offset; return utcMidnight - offset;
} }
+2
View File
@@ -14,6 +14,7 @@ import { campaignRouter } from './campaign.js';
import { areaRouter } from './area.js'; import { areaRouter } from './area.js';
import { blockerRouter } from './blocker.js'; import { blockerRouter } from './blocker.js';
import { timeRouter } from './time.js'; import { timeRouter } from './time.js';
import { searchRouter } from './search.js';
export const appRouter = router({ export const appRouter = router({
health: publicProcedure.query(() => ({ health: publicProcedure.query(() => ({
@@ -34,6 +35,7 @@ export const appRouter = router({
dayEntry: dayEntryRouter, dayEntry: dayEntryRouter,
time: timeRouter, time: timeRouter,
dashboard: dashboardRouter, dashboard: dashboardRouter,
search: searchRouter,
}); });
export type AppRouter = typeof appRouter; export type AppRouter = typeof appRouter;
+2 -2
View File
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { TRPCError } from '@trpc/server'; import { TRPCError } from '@trpc/server';
import { eq, isNull, desc } from 'drizzle-orm'; import { eq, isNull, desc } from 'drizzle-orm';
import { blocker, project, user } from '@cockpit/db'; import { blocker, project, user } from '@cockpit/db';
import { router, protectedProcedure } from '../trpc.js'; import { router, protectedProcedure, auditedProcedure } from '../trpc.js';
export const blockerRouter = router({ export const blockerRouter = router({
listOpen: protectedProcedure.query(async ({ ctx }) => { listOpen: protectedProcedure.query(async ({ ctx }) => {
@@ -52,7 +52,7 @@ export const blockerRouter = router({
return created; return created;
}), }),
resolve: protectedProcedure resolve: auditedProcedure('blocker.resolve')
.input( .input(
z.object({ z.object({
blockerId: z.string().uuid(), blockerId: z.string().uuid(),
+2 -1
View File
@@ -41,7 +41,8 @@ export const changeRouter = router({
const existing = ( const existing = (
await ctx.db.select().from(changeEntry).where(eq(changeEntry.id, id)).limit(1) await ctx.db.select().from(changeEntry).where(eq(changeEntry.id, id)).limit(1)
)[0]; )[0];
if (!existing) throw new TRPCError({ code: 'NOT_FOUND', message: 'Eintrag nicht gefunden.' }); if (!existing)
throw new TRPCError({ code: 'NOT_FOUND', message: 'Eintrag nicht gefunden.' });
return existing; return existing;
} }
const [updated] = await ctx.db const [updated] = await ctx.db
+11 -1
View File
@@ -1,5 +1,15 @@
import { and, eq, ne, isNull, isNotNull, lt, count, asc, desc } from 'drizzle-orm'; import { and, eq, ne, isNull, isNotNull, lt, count, asc, desc } from 'drizzle-orm';
import { area, project, blocker, dayEntry, user, risk, milestone, type Area, type Project } from '@cockpit/db'; import {
area,
project,
blocker,
dayEntry,
user,
risk,
milestone,
type Area,
type Project,
} from '@cockpit/db';
import { router, protectedProcedure } from '../trpc.js'; import { router, protectedProcedure } from '../trpc.js';
import { todayIso, previousWerktag } from '../lib/werktag.js'; import { todayIso, previousWerktag } from '../lib/werktag.js';
import { aggregateAreaAmpel } from '../lib/ampel.js'; import { aggregateAreaAmpel } from '../lib/ampel.js';
+297 -57
View File
@@ -1,11 +1,131 @@
import { TRPCError } from '@trpc/server'; import { TRPCError } from '@trpc/server';
import { and, eq, isNull, lt, asc, desc, inArray } from 'drizzle-orm'; import { z } from 'zod';
import { dayEntry, todo, blocker, user, type Todo } from '@cockpit/db'; import { and, eq, gt, gte, isNull, lt, lte, asc, desc, inArray } from 'drizzle-orm';
import { dayEntry, todo, blocker, user, type Db, type DayEntry, type Todo } from '@cockpit/db';
import { DayEntrySchemas } from '@cockpit/shared'; import { DayEntrySchemas } from '@cockpit/shared';
import { router, protectedProcedure } from '../trpc.js'; import { router, protectedProcedure } from '../trpc.js';
import { todayIso, previousWerktag, nextWerktag } from '../lib/werktag.js'; import {
todayIso,
previousWerktag,
addCalendarDays,
workdayCutoffMs,
isWorkdaySealed,
isEditableWithinGrace,
} from '../lib/werktag.js';
import { kimaiClockIn, kimaiClockOut, kimaiEnabled } from '../lib/kimai.js'; import { kimaiClockIn, kimaiClockOut, kimaiEnabled } from '../lib/kimai.js';
/**
* Der 6-Uhr-Schnitt: Ist um 06:00 (Berlin) noch ein Eintrag offen, dessen
* Arbeitstag (= Check-in-Kalendertag) abgelaufen ist, wird er automatisch beendet
* (checkedOutAt = 06:00 des Folgetags) und ein nahtloser Folge-Tag gestartet —
* offene ToDos wandern mit. So entstehen aus Nacht-Durcharbeiten saubere
* Tagesgrenzen, ohne dass der Nutzer manuell aus- und wieder einstempeln muss.
*
* Idempotent: ohne offenen, abgelaufenen Eintrag passiert nichts. Die Schleife
* deckt (selten) mehrtägiges Durchlaufen ab; das Limit ist ein Sicherheitsnetz.
*/
export async function applyWorkdayBoundary(db: Db, userId: string, now: Date): Promise<void> {
for (let i = 0; i < 14; i++) {
const open = (
await db
.select()
.from(dayEntry)
.where(and(eq(dayEntry.userId, userId), isNull(dayEntry.checkedOutAt)))
.orderBy(desc(dayEntry.date))
.limit(1)
)[0];
if (!open || !isWorkdaySealed(open.date, now)) return;
const cutoff = new Date(workdayCutoffMs(open.date));
const nextDate = addCalendarDays(open.date, 1);
await db.transaction(async (tx) => {
// 1) Alten Tag um 06:00 beenden.
await tx
.update(dayEntry)
.set({ checkedOutAt: cutoff, updatedAt: now })
.where(eq(dayEntry.id, open.id));
if (open.kimaiTimesheetId !== null && kimaiEnabled()) {
await kimaiClockOut({ timesheetId: open.kimaiTimesheetId });
}
// 2) Folge-Tag nur anlegen, wenn es ihn noch nicht gibt (unique userId+date).
const existsNext = (
await tx
.select({ id: dayEntry.id })
.from(dayEntry)
.where(and(eq(dayEntry.userId, userId), eq(dayEntry.date, nextDate)))
.limit(1)
)[0];
if (existsNext) return;
const [created] = await tx
.insert(dayEntry)
.values({
userId,
date: nextDate,
status: 'begun',
checkedInAt: cutoff,
// Kein echter Lock-in — Anwesenheits-Anzeigen ignorieren diesen Check-in.
autoCheckedIn: true,
})
.returning();
if (!created) throw new Error('Folge-Tag konnte nicht angelegt werden.');
// 3) Offene ToDos in den neuen Tag übernehmen (im alten als übertragen markiert).
const openTodos = await tx
.select()
.from(todo)
.where(and(eq(todo.dayEntryId, open.id), eq(todo.status, 'open')))
.orderBy(asc(todo.order));
if (openTodos.length > 0) {
await tx.insert(todo).values(
openTodos.map((t, idx) => ({
dayEntryId: created.id,
userId,
date: nextDate,
title: t.title,
order: idx,
bezugKind: t.bezugKind,
bezugId: t.bezugId,
carriedOver: true,
})),
);
await tx
.update(todo)
.set({ carriedOver: true })
.where(
inArray(
todo.id,
openTodos.map((t) => t.id),
),
);
}
});
}
}
/**
* Der aktive Arbeitstag des Nutzers nach Anwendung des 6-Uhr-Schnitts: der jüngste
* Eintrag, der noch nicht versiegelt ist (offen ODER bereits ausgecheckt, aber vor
* 06:00 des Folgetags — also noch fortsetzbar). `null`, wenn kein laufender/heutiger
* Tag existiert (→ Frontend zeigt das Einstempel-Formular).
*/
export async function getActiveEntry(db: Db, userId: string, now: Date): Promise<DayEntry | null> {
await applyWorkdayBoundary(db, userId, now);
const entry = (
await db
.select()
.from(dayEntry)
.where(eq(dayEntry.userId, userId))
.orderBy(desc(dayEntry.date))
.limit(1)
)[0];
if (!entry || isWorkdaySealed(entry.date, now)) return null;
return entry;
}
export const dayEntryRouter = router({ export const dayEntryRouter = router({
/** /**
* Heutige ToDos aller aktiven Mitarbeiter, gruppiert pro User. * Heutige ToDos aller aktiven Mitarbeiter, gruppiert pro User.
@@ -14,11 +134,9 @@ export const dayEntryRouter = router({
*/ */
todayTeam: protectedProcedure.query(async ({ ctx }) => { todayTeam: protectedProcedure.query(async ({ ctx }) => {
const date = todayIso(); const date = todayIso();
const entries = await ctx.db const entries = await ctx.db.select().from(dayEntry).where(eq(dayEntry.date, date));
.select() if (entries.length === 0)
.from(dayEntry) return [] as Array<{ userId: string; entryStatus: string; todos: Todo[] }>;
.where(eq(dayEntry.date, date));
if (entries.length === 0) return [] as Array<{ userId: string; entryStatus: string; todos: Todo[] }>;
const ids = entries.map((e) => e.id); const ids = entries.map((e) => e.id);
const todos = await ctx.db const todos = await ctx.db
.select() .select()
@@ -65,25 +183,22 @@ export const dayEntryRouter = router({
}), }),
/** /**
* Heute-Status der eigenen Person. * Heute-Status der eigenen Person. „Heute" = der aktive Arbeitstag: ein laufender
* (offener) Eintrag bleibt aktiv, auch über Mitternacht hinaus, bis 06:00 des
* Folgetags. Ein bereits ausgecheckter Tag bleibt bis dahin sichtbar (fortsetzbar).
*/ */
today: protectedProcedure.query(async ({ ctx }) => { today: protectedProcedure.query(async ({ ctx }) => {
const date = todayIso(); const now = new Date();
const rows = await ctx.db const entry = await getActiveEntry(ctx.db, ctx.user.id, now);
.select()
.from(dayEntry)
.where(and(eq(dayEntry.userId, ctx.user.id), eq(dayEntry.date, date)))
.limit(1);
const entry = rows[0] ?? null;
if (!entry) { if (!entry) {
return { date, entry: null, todos: [] as Todo[] }; return { date: todayIso(now), entry: null, todos: [] as Todo[] };
} }
const todos = await ctx.db const todos = await ctx.db
.select() .select()
.from(todo) .from(todo)
.where(eq(todo.dayEntryId, entry.id)) .where(eq(todo.dayEntryId, entry.id))
.orderBy(todo.order); .orderBy(todo.order);
return { date, entry, todos }; return { date: entry.date, entry, todos };
}), }),
/** /**
@@ -92,6 +207,8 @@ export const dayEntryRouter = router({
checkIn: protectedProcedure checkIn: protectedProcedure
.input(DayEntrySchemas.checkInInput) .input(DayEntrySchemas.checkInInput)
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
// Erst einen ggf. abgelaufenen Nacht-Eintrag sauber abschließen (6-Uhr-Schnitt).
await applyWorkdayBoundary(ctx.db, ctx.user.id, new Date());
const date = input.date ?? todayIso(); const date = input.date ?? todayIso();
// Verhindert Doppel-Einstempeln. Wenn bereits Einträge existieren, Fehler. // Verhindert Doppel-Einstempeln. Wenn bereits Einträge existieren, Fehler.
@@ -181,24 +298,25 @@ export const dayEntryRouter = router({
}), }),
/** /**
* Check-Out / Arbeitsende: markiert das Ende der Arbeits-Session. Best-effort * Check-Out / Arbeitsende: beendet den laufenden (offenen) Arbeitstag — egal, ob
* er heute oder gestern (Nachtarbeit über Mitternacht) begonnen wurde. Best-effort
* Kimai-Clock-Out, falls beim Check-In ein Timesheet gestartet wurde. * Kimai-Clock-Out, falls beim Check-In ein Timesheet gestartet wurde.
*/ */
checkOut: protectedProcedure.mutation(async ({ ctx }) => { checkOut: protectedProcedure.mutation(async ({ ctx }) => {
const date = todayIso(); const now = new Date();
await applyWorkdayBoundary(ctx.db, ctx.user.id, now);
const entry = ( const entry = (
await ctx.db await ctx.db
.select() .select()
.from(dayEntry) .from(dayEntry)
.where(and(eq(dayEntry.userId, ctx.user.id), eq(dayEntry.date, date))) .where(and(eq(dayEntry.userId, ctx.user.id), isNull(dayEntry.checkedOutAt)))
.orderBy(desc(dayEntry.date))
.limit(1) .limit(1)
)[0]; )[0];
if (!entry) { if (!entry) {
throw new TRPCError({ code: 'BAD_REQUEST', message: 'Du bist heute noch nicht locked in.' }); throw new TRPCError({ code: 'BAD_REQUEST', message: 'Du bist gerade nicht eingestempelt.' });
} }
if (entry.checkedOutAt) return entry;
const now = new Date();
const [updated] = await ctx.db const [updated] = await ctx.db
.update(dayEntry) .update(dayEntry)
.set({ checkedOutAt: now, updatedAt: now }) .set({ checkedOutAt: now, updatedAt: now })
@@ -211,6 +329,46 @@ export const dayEntryRouter = router({
return updated; return updated;
}), }),
/**
* „Arbeit fortsetzen" — hebt einen Feierabend wieder auf (versehentlich geklickt
* oder doch noch weitergearbeitet). Öffnet den aktiven, noch nicht versiegelten
* Tag erneut (checkedOutAt → null). Möglich, solange der Arbeitstag läuft, d. h.
* vor 06:00 des Folgetags. Danach ist der Tag final → neu einstempeln.
*/
reopen: protectedProcedure.mutation(async ({ ctx }) => {
const now = new Date();
const entry = await getActiveEntry(ctx.db, ctx.user.id, now);
if (!entry) {
throw new TRPCError({
code: 'BAD_REQUEST',
message:
'Kein fortsetzbarer Arbeitstag — der letzte Tag ist abgeschlossen. Stempel neu ein.',
});
}
if (!entry.checkedOutAt) return entry; // läuft bereits
const [updated] = await ctx.db
.update(dayEntry)
.set({ checkedOutAt: null, updatedAt: now })
.where(eq(dayEntry.id, entry.id))
.returning();
// Best-effort: Kimai wieder anlaufen lassen, falls aktiv.
if (kimaiEnabled()) {
const tsId = await kimaiClockIn({
begin: now,
description: `ebw — ${ctx.user.name} (fortgesetzt)`,
});
if (tsId !== null) {
await ctx.db
.update(dayEntry)
.set({ kimaiTimesheetId: tsId, kimaiSynced: true })
.where(eq(dayEntry.id, entry.id));
}
}
return updated;
}),
/** /**
* ToDos im Verlauf des Tages ändern (vor Reflexion). * ToDos im Verlauf des Tages ändern (vor Reflexion).
*/ */
@@ -257,8 +415,8 @@ export const dayEntryRouter = router({
/** /**
* Einzelnen ToDo-Titel korrigieren (z. B. Tippfehler) — auch noch in der * Einzelnen ToDo-Titel korrigieren (z. B. Tippfehler) — auch noch in der
* Reflexion. Erlaubt, solange das ToDo der eigenen Person gehört und vom * Reflexion. Erlaubt, solange der Arbeitstag des ToDos noch läuft (vor 06:00 des
* heutigen Berlin-Tag ist (gleiche Editierbarkeits-Regel wie die Reflexion). * Folgetags); gleiche Editierbarkeits-Regel wie die Reflexion.
*/ */
editTodoTitle: protectedProcedure editTodoTitle: protectedProcedure
.input(DayEntrySchemas.editTodoTitleInput) .input(DayEntrySchemas.editTodoTitleInput)
@@ -272,10 +430,10 @@ export const dayEntryRouter = router({
if (!existing) { if (!existing) {
throw new TRPCError({ code: 'NOT_FOUND', message: 'ToDo nicht gefunden.' }); throw new TRPCError({ code: 'NOT_FOUND', message: 'ToDo nicht gefunden.' });
} }
if (existing.date !== todayIso(new Date())) { if (!isEditableWithinGrace(existing.date, new Date())) {
throw new TRPCError({ throw new TRPCError({
code: 'BAD_REQUEST', code: 'BAD_REQUEST',
message: 'ToDos eines Vortags können nicht mehr bearbeitet werden.', message: 'ToDos können nur bis 3 Tage nach dem Tag bearbeitet werden.',
}); });
} }
const [updated] = await ctx.db const [updated] = await ctx.db
@@ -293,18 +451,11 @@ export const dayEntryRouter = router({
addTodo: protectedProcedure addTodo: protectedProcedure
.input(DayEntrySchemas.addTodoInput) .input(DayEntrySchemas.addTodoInput)
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
const date = todayIso(); const entry = await getActiveEntry(ctx.db, ctx.user.id, new Date());
const entry = (
await ctx.db
.select()
.from(dayEntry)
.where(and(eq(dayEntry.userId, ctx.user.id), eq(dayEntry.date, date)))
.limit(1)
)[0];
if (!entry) { if (!entry) {
throw new TRPCError({ throw new TRPCError({
code: 'BAD_REQUEST', code: 'BAD_REQUEST',
message: 'Du bist heute noch nicht locked in.', message: 'Du bist gerade nicht eingestempelt.',
}); });
} }
const existing = await ctx.db const existing = await ctx.db
@@ -334,16 +485,12 @@ export const dayEntryRouter = router({
addUnplanned: protectedProcedure addUnplanned: protectedProcedure
.input(DayEntrySchemas.addUnplannedInput) .input(DayEntrySchemas.addUnplannedInput)
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
const date = todayIso(); const entry = await getActiveEntry(ctx.db, ctx.user.id, new Date());
const entry = (
await ctx.db
.select()
.from(dayEntry)
.where(and(eq(dayEntry.userId, ctx.user.id), eq(dayEntry.date, date)))
.limit(1)
)[0];
if (!entry) { if (!entry) {
throw new TRPCError({ code: 'BAD_REQUEST', message: 'Du bist heute noch nicht locked in.' }); throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Du bist gerade nicht eingestempelt.',
});
} }
const existing = await ctx.db const existing = await ctx.db
.select({ id: todo.id }) .select({ id: todo.id })
@@ -382,13 +529,12 @@ export const dayEntryRouter = router({
if (!entry) { if (!entry) {
throw new TRPCError({ code: 'NOT_FOUND', message: 'Tageseintrag nicht gefunden.' }); throw new TRPCError({ code: 'NOT_FOUND', message: 'Tageseintrag nicht gefunden.' });
} }
// Editierbar, solange das Eintrags-Datum noch der heutige Berlin-Tag ist. // Reflexion ist bis 3 Kalendertage nach dem Eintragstag nachträglich
// Damit kann mehrmals am Tag aktualisiert werden; nach 00:00 (Europe/Berlin) // editierbar (Nachfrist für die Historie). Danach final.
// ist der Vortag final und kann nicht mehr verändert werden. if (!isEditableWithinGrace(entry.date, new Date())) {
if (entry.date !== todayIso(new Date())) {
throw new TRPCError({ throw new TRPCError({
code: 'BAD_REQUEST', code: 'BAD_REQUEST',
message: 'Reflexion eines Vortags kann nicht mehr bearbeitet werden.', message: 'Reflexion kann nur bis 3 Tage nach dem Tag bearbeitet werden.',
}); });
} }
@@ -479,7 +625,18 @@ export const dayEntryRouter = router({
.input(DayEntrySchemas.historyForDateInput) .input(DayEntrySchemas.historyForDateInput)
.query(async ({ ctx, input }) => { .query(async ({ ctx, input }) => {
const today = todayIso(); const today = todayIso();
const date = input.date ?? previousWerktag(today); // Default-Tag = der jüngste Tag VOR heute, an dem es überhaupt Einträge gibt
// (nicht starr der vorige Werktag — sonst sieht man Wochenend-Arbeit nicht).
const fallbackDate =
(
await ctx.db
.select({ d: dayEntry.date })
.from(dayEntry)
.where(lt(dayEntry.date, today))
.orderBy(desc(dayEntry.date))
.limit(1)
)[0]?.d ?? previousWerktag(today);
const date = input.date ?? fallbackDate;
const isToday = date === today; const isToday = date === today;
const entries = await ctx.db.select().from(dayEntry).where(eq(dayEntry.date, date)); const entries = await ctx.db.select().from(dayEntry).where(eq(dayEntry.date, date));
@@ -491,7 +648,11 @@ export const dayEntryRouter = router({
const ids = entries.map((e) => e.id); const ids = entries.map((e) => e.id);
const todoRows = ids.length const todoRows = ids.length
? await ctx.db.select().from(todo).where(inArray(todo.dayEntryId, ids)).orderBy(asc(todo.order)) ? await ctx.db
.select()
.from(todo)
.where(inArray(todo.dayEntryId, ids))
.orderBy(asc(todo.order))
: []; : [];
const todosByEntry = new Map<string, Todo[]>(); const todosByEntry = new Map<string, Todo[]>();
for (const t of todoRows) { for (const t of todoRows) {
@@ -526,11 +687,28 @@ export const dayEntryRouter = router({
.map((u) => u.name) .map((u) => u.name)
.sort((a, b) => a.localeCompare(b)); .sort((a, b) => a.localeCompare(b));
const nw = nextWerktag(date); // Pfeil-Navigation springt zum nächsten/vorherigen Tag MIT Einträgen
// (überspringt leere Tage, erreicht aber Wochenend-Arbeit).
const prevRow = (
await ctx.db
.select({ d: dayEntry.date })
.from(dayEntry)
.where(lt(dayEntry.date, date))
.orderBy(desc(dayEntry.date))
.limit(1)
)[0];
const nextRow = (
await ctx.db
.select({ d: dayEntry.date })
.from(dayEntry)
.where(and(gt(dayEntry.date, date), lte(dayEntry.date, today)))
.orderBy(asc(dayEntry.date))
.limit(1)
)[0];
return { return {
date, date,
prevDate: previousWerktag(date), prevDate: prevRow?.d ?? null,
nextDate: nw < today ? nw : null, nextDate: nextRow?.d ?? null,
entries: list, entries: list,
ohneEintrag, ohneEintrag,
}; };
@@ -550,11 +728,73 @@ export const dayEntryRouter = router({
.where(eq(dayEntry.date, date)); .where(eq(dayEntry.date, date));
return rows; return rows;
}), }),
/**
* Persönliche Wochenübersicht: die letzten 7 Kalendertage des eigenen Users —
* pro Tag Status/Ampel/Trend, grobe Anwesenheit (Antritt→Feierabend) und ein
* ToDo-Zähler (erledigt/offen/verworfen). Speist die Route „Meine Woche".
*/
myWeek: protectedProcedure.query(async ({ ctx }) => {
const today = todayIso();
const from = addCalendarDays(today, -6);
const entries = await ctx.db
.select()
.from(dayEntry)
.where(
and(eq(dayEntry.userId, ctx.user.id), gte(dayEntry.date, from), lte(dayEntry.date, today)),
)
.orderBy(asc(dayEntry.date));
const ids = entries.map((e) => e.id);
const todos = ids.length
? await ctx.db.select().from(todo).where(inArray(todo.dayEntryId, ids))
: [];
const counts = new Map<string, { done: number; open: number; dropped: number }>();
for (const t of todos) {
const c = counts.get(t.dayEntryId) ?? { done: 0, open: 0, dropped: 0 };
c[t.status] += 1;
counts.set(t.dayEntryId, c);
}
return entries.map((e) => ({
date: e.date,
status: e.status,
ampel: e.ampel,
trend: e.trend,
checkedInAt: e.checkedInAt,
checkedOutAt: e.checkedOutAt,
todos: counts.get(e.id) ?? { done: 0, open: 0, dropped: 0 },
}));
}),
/**
* Eigener Tageseintrag eines bestimmten Datums — zum nachträglichen Reflektieren
* aus der Historie. `editable` zeigt, ob die 3-Tage-Nachfrist noch läuft.
*/
ownForDate: protectedProcedure
.input(z.object({ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/) }))
.query(async ({ ctx, input }) => {
const entry =
(
await ctx.db
.select()
.from(dayEntry)
.where(and(eq(dayEntry.userId, ctx.user.id), eq(dayEntry.date, input.date)))
.limit(1)
)[0] ?? null;
if (!entry) return { entry: null, todos: [] as Todo[], editable: false };
const todos = await ctx.db
.select()
.from(todo)
.where(eq(todo.dayEntryId, entry.id))
.orderBy(todo.order);
return { entry, todos, editable: isEditableWithinGrace(entry.date, new Date()) };
}),
}); });
// Helper für Cron-Endpoint // Helper für Cron-Endpoint
export async function publishYesterdaysEntries( export async function publishYesterdaysEntries(
ctx: { db: import('@cockpit/db').Db }, ctx: { db: Db },
yesterdayIso: string, yesterdayIso: string,
): Promise<number> { ): Promise<number> {
const now = new Date(); const now = new Date();
+1 -2
View File
@@ -65,8 +65,7 @@ export const dealRouter = router({
enteredStageAt: new Date(), enteredStageAt: new Date(),
wonAt: input.stage === 'abschluss' ? new Date() : null, wonAt: input.stage === 'abschluss' ? new Date() : null,
// Gewonnener Deal = voller Auftragswert (nicht mit Wahrscheinlichkeit gewichtet). // Gewonnener Deal = voller Auftragswert (nicht mit Wahrscheinlichkeit gewichtet).
wonValueEur: wonValueEur: input.stage === 'abschluss' ? sql`COALESCE(${deal.valueEur}, 0)` : null,
input.stage === 'abschluss' ? sql`COALESCE(${deal.valueEur}, 0)` : null,
}) })
.where(eq(deal.id, input.dealId)) .where(eq(deal.id, input.dealId))
.returning(); .returning();
+48 -12
View File
@@ -1,10 +1,11 @@
import { TRPCError } from '@trpc/server'; import { TRPCError } from '@trpc/server';
import { asc, desc, eq, sql } from 'drizzle-orm'; import { and, asc, desc, eq, inArray, isNotNull, lte, sql } from 'drizzle-orm';
import { lead, leadContact, leadTouchpoint, deal, area, user, project } from '@cockpit/db'; import { lead, leadContact, leadTouchpoint, deal, area, user, project } from '@cockpit/db';
import type { Db } from '@cockpit/db'; import type { Db } from '@cockpit/db';
import { LeadSchemas } from '@cockpit/shared'; import { LeadSchemas } from '@cockpit/shared';
import { router, protectedProcedure } from '../trpc.js'; import { router, protectedProcedure } from '../trpc.js';
import { parseCsv, normalizeHeader } from '../lib/csv.js'; import { parseCsv, normalizeHeader } from '../lib/csv.js';
import { todayIso } from '../lib/werktag.js';
const SALES_AREA_SLUG = 'vertrieb'; const SALES_AREA_SLUG = 'vertrieb';
@@ -30,6 +31,35 @@ export const leadRouter = router({
return rows.map((r) => ({ ...r.lead, ownerName: r.ownerName, projectName: r.projectName })); return rows.map((r) => ({ ...r.lead, ownerName: r.ownerName, projectName: r.projectName }));
}), }),
/**
* Fällige Wiedervorlagen: aktive Leads (cold/warm/hot), deren geplanter nächster
* Schritt heute oder überfällig ist. naechsterSchrittDatum wurde erfasst, aber
* nie als Liste gebündelt — so geht keine warme Spur mehr unter.
*/
dueFollowUps: protectedProcedure.query(async ({ ctx }) => {
const today = todayIso();
const rows = await ctx.db
.select({
id: lead.id,
firma: lead.firma,
status: lead.status,
ownerName: user.name,
naechsterSchritt: lead.naechsterSchritt,
faelligAm: lead.naechsterSchrittDatum,
})
.from(lead)
.leftJoin(user, eq(user.id, lead.ownerUserId))
.where(
and(
inArray(lead.status, ['cold', 'warm', 'hot']),
isNotNull(lead.naechsterSchrittDatum),
lte(lead.naechsterSchrittDatum, today),
),
)
.orderBy(asc(lead.naechsterSchrittDatum));
return rows;
}),
// Leads, die einem Projekt zugeordnet sind (Vertriebs-Sicht im Projekt). // Leads, die einem Projekt zugeordnet sind (Vertriebs-Sicht im Projekt).
forProject: protectedProcedure forProject: protectedProcedure
.input(LeadSchemas.leadsForProjectInput) .input(LeadSchemas.leadsForProjectInput)
@@ -61,11 +91,13 @@ export const leadRouter = router({
.where(eq(leadTouchpoint.leadId, l.id)) .where(eq(leadTouchpoint.leadId, l.id))
.orderBy(desc(leadTouchpoint.datum), desc(leadTouchpoint.createdAt)); .orderBy(desc(leadTouchpoint.datum), desc(leadTouchpoint.createdAt));
const linkedProject = l.projectId const linkedProject = l.projectId
? (await ctx.db ? ((
await ctx.db
.select({ id: project.id, name: project.name }) .select({ id: project.id, name: project.name })
.from(project) .from(project)
.where(eq(project.id, l.projectId)) .where(eq(project.id, l.projectId))
.limit(1))[0] ?? null .limit(1)
)[0] ?? null)
: null; : null;
return { return {
lead: l, lead: l,
@@ -75,9 +107,7 @@ export const leadRouter = router({
}; };
}), }),
create: protectedProcedure create: protectedProcedure.input(LeadSchemas.createLeadInput).mutation(async ({ ctx, input }) => {
.input(LeadSchemas.createLeadInput)
.mutation(async ({ ctx, input }) => {
const areaId = await getSalesAreaId(ctx.db); const areaId = await getSalesAreaId(ctx.db);
const [created] = await ctx.db const [created] = await ctx.db
.insert(lead) .insert(lead)
@@ -99,9 +129,7 @@ export const leadRouter = router({
return created; return created;
}), }),
update: protectedProcedure update: protectedProcedure.input(LeadSchemas.updateLeadInput).mutation(async ({ ctx, input }) => {
.input(LeadSchemas.updateLeadInput)
.mutation(async ({ ctx, input }) => {
const { id, ...patch } = input; const { id, ...patch } = input;
if (Object.keys(patch).length === 0) { if (Object.keys(patch).length === 0) {
const existing = (await ctx.db.select().from(lead).where(eq(lead.id, id)).limit(1))[0]; const existing = (await ctx.db.select().from(lead).where(eq(lead.id, id)).limit(1))[0];
@@ -121,7 +149,8 @@ export const leadRouter = router({
addContact: protectedProcedure addContact: protectedProcedure
.input(LeadSchemas.addContactInput) .input(LeadSchemas.addContactInput)
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
const count = ( const count =
(
await ctx.db await ctx.db
.select({ c: sql<number>`count(*)::int` }) .select({ c: sql<number>`count(*)::int` })
.from(leadContact) .from(leadContact)
@@ -222,7 +251,13 @@ export const leadRouter = router({
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
const areaId = await getSalesAreaId(ctx.db); const areaId = await getSalesAreaId(ctx.db);
const rows = parseCsv(input.csv); const rows = parseCsv(input.csv);
const summary = { created: 0, skippedEmpty: 0, skippedDuplicate: 0, contacts: 0, touchpoints: 0 }; const summary = {
created: 0,
skippedEmpty: 0,
skippedDuplicate: 0,
contacts: 0,
touchpoints: 0,
};
if (rows.length < 2 || !rows[0]) return summary; if (rows.length < 2 || !rows[0]) return summary;
const header = rows[0].map(normalizeHeader); const header = rows[0].map(normalizeHeader);
@@ -243,7 +278,8 @@ export const leadRouter = router({
branche: col('branche'), branche: col('branche'),
notizen: col('notizen'), notizen: col('notizen'),
}; };
const get = (row: string[], i: number) => (i >= 0 && i < row.length ? (row[i] ?? '').trim() : ''); const get = (row: string[], i: number) =>
i >= 0 && i < row.length ? (row[i] ?? '').trim() : '';
const existing = await ctx.db.select({ firma: lead.firma }).from(lead); const existing = await ctx.db.select({ firma: lead.firma }).from(lead);
const seen = new Set(existing.map((e) => e.firma.trim().toLowerCase())); const seen = new Set(existing.map((e) => e.firma.trim().toLowerCase()));
+20 -8
View File
@@ -1,9 +1,17 @@
import { TRPCError } from '@trpc/server'; import { TRPCError } from '@trpc/server';
import { z } from 'zod'; import { z } from 'zod';
import { and, eq, desc } from 'drizzle-orm'; import { and, eq, desc } from 'drizzle-orm';
import { project, milestone, area, user, projectStatus, phaseGate, type Project } from '@cockpit/db'; import {
project,
milestone,
area,
user,
projectStatus,
phaseGate,
type Project,
} from '@cockpit/db';
import { ProjectSchemas } from '@cockpit/shared'; import { ProjectSchemas } from '@cockpit/shared';
import { router, protectedProcedure } from '../trpc.js'; import { router, protectedProcedure, auditedProcedure } from '../trpc.js';
const PHASE_ORDER = ['definition', 'planung', 'umsetzung', 'abschluss'] as const; const PHASE_ORDER = ['definition', 'planung', 'umsetzung', 'abschluss'] as const;
function nextPhase(p: (typeof PHASE_ORDER)[number]): (typeof PHASE_ORDER)[number] { function nextPhase(p: (typeof PHASE_ORDER)[number]): (typeof PHASE_ORDER)[number] {
@@ -108,7 +116,7 @@ export const projectRouter = router({
return result; return result;
}), }),
archive: protectedProcedure archive: auditedProcedure('project.archive')
.input(ProjectSchemas.archiveProjectInput) .input(ProjectSchemas.archiveProjectInput)
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
const p = ( const p = (
@@ -129,6 +137,7 @@ export const projectRouter = router({
phase: 'abschluss', phase: 'abschluss',
lessonsLearnedUrl: input.lessonsLearnedUrl, lessonsLearnedUrl: input.lessonsLearnedUrl,
abschlussvermerk: input.abschlussvermerk ?? p.abschlussvermerk, abschlussvermerk: input.abschlussvermerk ?? p.abschlussvermerk,
lessonsLearned: input.lessonsLearned ?? p.lessonsLearned,
pflichtMinimumState: { ...p.pflichtMinimumState, retrospektive: true }, pflichtMinimumState: { ...p.pflichtMinimumState, retrospektive: true },
}) })
.where(eq(project.id, input.projectId)) .where(eq(project.id, input.projectId))
@@ -137,7 +146,7 @@ export const projectRouter = router({
}), }),
// Phase direkt setzen (Leitfaden Kap. 2). // Phase direkt setzen (Leitfaden Kap. 2).
setPhase: protectedProcedure setPhase: auditedProcedure('project.setPhase')
.input(ProjectSchemas.setPhaseInput) .input(ProjectSchemas.setPhaseInput)
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
const [updated] = await ctx.db const [updated] = await ctx.db
@@ -150,7 +159,7 @@ export const projectRouter = router({
}), }),
// Gate-Review am Phasenende (Leitfaden Kap. 5), optional Folgephase freigeben. // Gate-Review am Phasenende (Leitfaden Kap. 5), optional Folgephase freigeben.
addPhaseGate: protectedProcedure addPhaseGate: auditedProcedure('project.addPhaseGate')
.input(ProjectSchemas.addPhaseGateInput) .input(ProjectSchemas.addPhaseGateInput)
.mutation(async ({ ctx, input }) => { .mutation(async ({ ctx, input }) => {
const [gate] = await ctx.db const [gate] = await ctx.db
@@ -258,7 +267,8 @@ export const projectRouter = router({
const existing = ( const existing = (
await ctx.db.select().from(project).where(eq(project.id, projectId)).limit(1) await ctx.db.select().from(project).where(eq(project.id, projectId)).limit(1)
)[0]; )[0];
if (!existing) throw new TRPCError({ code: 'NOT_FOUND', message: 'Projekt nicht gefunden.' }); if (!existing)
throw new TRPCError({ code: 'NOT_FOUND', message: 'Projekt nicht gefunden.' });
return existing; return existing;
} }
const [updated] = await ctx.db const [updated] = await ctx.db
@@ -312,7 +322,8 @@ export const projectRouter = router({
const existing = ( const existing = (
await ctx.db.select().from(milestone).where(eq(milestone.id, milestoneId)).limit(1) await ctx.db.select().from(milestone).where(eq(milestone.id, milestoneId)).limit(1)
)[0]; )[0];
if (!existing) throw new TRPCError({ code: 'NOT_FOUND', message: 'Meilenstein nicht gefunden.' }); if (!existing)
throw new TRPCError({ code: 'NOT_FOUND', message: 'Meilenstein nicht gefunden.' });
return existing; return existing;
} }
const [updated] = await ctx.db const [updated] = await ctx.db
@@ -320,7 +331,8 @@ export const projectRouter = router({
.set(patch) .set(patch)
.where(eq(milestone.id, milestoneId)) .where(eq(milestone.id, milestoneId))
.returning(); .returning();
if (!updated) throw new TRPCError({ code: 'NOT_FOUND', message: 'Meilenstein nicht gefunden.' }); if (!updated)
throw new TRPCError({ code: 'NOT_FOUND', message: 'Meilenstein nicht gefunden.' });
return updated; return updated;
}), }),
+3 -9
View File
@@ -15,9 +15,7 @@ export const riskRouter = router({
.orderBy(desc(risk.showstopper), desc(risk.createdAt)); .orderBy(desc(risk.showstopper), desc(risk.createdAt));
}), }),
create: protectedProcedure create: protectedProcedure.input(RiskSchemas.createRiskInput).mutation(async ({ ctx, input }) => {
.input(RiskSchemas.createRiskInput)
.mutation(async ({ ctx, input }) => {
const [created] = await ctx.db const [created] = await ctx.db
.insert(risk) .insert(risk)
.values({ .values({
@@ -38,9 +36,7 @@ export const riskRouter = router({
return created; return created;
}), }),
update: protectedProcedure update: protectedProcedure.input(RiskSchemas.updateRiskInput).mutation(async ({ ctx, input }) => {
.input(RiskSchemas.updateRiskInput)
.mutation(async ({ ctx, input }) => {
const { id, ...patch } = input; const { id, ...patch } = input;
if (Object.keys(patch).length === 0) { if (Object.keys(patch).length === 0) {
const existing = (await ctx.db.select().from(risk).where(eq(risk.id, id)).limit(1))[0]; const existing = (await ctx.db.select().from(risk).where(eq(risk.id, id)).limit(1))[0];
@@ -56,9 +52,7 @@ export const riskRouter = router({
return updated; return updated;
}), }),
remove: protectedProcedure remove: protectedProcedure.input(RiskSchemas.removeRiskInput).mutation(async ({ ctx, input }) => {
.input(RiskSchemas.removeRiskInput)
.mutation(async ({ ctx, input }) => {
await ctx.db.delete(risk).where(eq(risk.id, input.id)); await ctx.db.delete(risk).where(eq(risk.id, input.id));
return { ok: true as const }; return { ok: true as const };
}), }),
+38
View File
@@ -0,0 +1,38 @@
import { z } from 'zod';
import { and, ilike, isNull } from 'drizzle-orm';
import { project, lead, blocker } from '@cockpit/db';
import { router, protectedProcedure } from '../trpc.js';
/**
* Globale Schnellsuche über die wichtigsten Entitäten (Projekte, Leads, offene
* Blocker). Postgres ILIKE — für die Teamgröße völlig ausreichend, kein FTS nötig.
*/
export const searchRouter = router({
all: protectedProcedure
.input(z.object({ q: z.string().min(1).max(100) }))
.query(async ({ ctx, input }) => {
const term = `%${input.q.replace(/[%_]/g, '\\$&')}%`;
const [projects, leads, blockers] = await Promise.all([
ctx.db
.select({ id: project.id, name: project.name, archiviert: project.archiviert })
.from(project)
.where(ilike(project.name, term))
.limit(8),
ctx.db
.select({ id: lead.id, firma: lead.firma })
.from(lead)
.where(ilike(lead.firma, term))
.limit(8),
ctx.db
.select({ id: blocker.id, title: blocker.title })
.from(blocker)
.where(and(ilike(blocker.title, term), isNull(blocker.resolvedAt)))
.limit(8),
]);
return {
projects: projects.map((p) => ({ id: p.id, label: p.name, archived: p.archiviert })),
leads: leads.map((l) => ({ id: l.id, label: l.firma })),
blockers: blockers.map((b) => ({ id: b.id, label: b.title })),
};
}),
});
+4 -2
View File
@@ -50,7 +50,8 @@ export const stakeholderRouter = router({
const existing = ( const existing = (
await ctx.db.select().from(stakeholder).where(eq(stakeholder.id, id)).limit(1) await ctx.db.select().from(stakeholder).where(eq(stakeholder.id, id)).limit(1)
)[0]; )[0];
if (!existing) throw new TRPCError({ code: 'NOT_FOUND', message: 'Stakeholder nicht gefunden.' }); if (!existing)
throw new TRPCError({ code: 'NOT_FOUND', message: 'Stakeholder nicht gefunden.' });
return existing; return existing;
} }
const [updated] = await ctx.db const [updated] = await ctx.db
@@ -58,7 +59,8 @@ export const stakeholderRouter = router({
.set(patch) .set(patch)
.where(eq(stakeholder.id, id)) .where(eq(stakeholder.id, id))
.returning(); .returning();
if (!updated) throw new TRPCError({ code: 'NOT_FOUND', message: 'Stakeholder nicht gefunden.' }); if (!updated)
throw new TRPCError({ code: 'NOT_FOUND', message: 'Stakeholder nicht gefunden.' });
return updated; return updated;
}), }),
+98 -8
View File
@@ -44,7 +44,10 @@ function unionSeconds(intervals: Array<readonly [number, number]>): number {
} }
async function stopOneEntry(db: Db, entry: TimeEntry, now: Date): Promise<TimeEntry | null> { async function stopOneEntry(db: Db, entry: TimeEntry, now: Date): Promise<TimeEntry | null> {
const durationSeconds = Math.max(0, Math.round((now.getTime() - entry.startedAt.getTime()) / 1000)); const durationSeconds = Math.max(
0,
Math.round((now.getTime() - entry.startedAt.getTime()) / 1000),
);
const [stopped] = await db const [stopped] = await db
.update(timeEntry) .update(timeEntry)
.set({ endedAt: now, durationSeconds, updatedAt: now }) .set({ endedAt: now, durationSeconds, updatedAt: now })
@@ -177,11 +180,36 @@ export const timeRouter = router({
0, 0,
); );
// Anwesenheits-Anker wie in teamToday: echter Lock-in, sonst (Auto-Tag vom
// 6-Uhr-Schnitt oder kein Eintrag) der erste Zeiteintrag des Tages.
const ownDay = (
await ctx.db
.select({
checkedInAt: dayEntry.checkedInAt,
checkedOutAt: dayEntry.checkedOutAt,
autoCheckedIn: dayEntry.autoCheckedIn,
})
.from(dayEntry)
.where(and(eq(dayEntry.userId, ctx.user.id), eq(dayEntry.date, today)))
.limit(1)
)[0];
const firstStartMs = rows.length ? Math.min(...rows.map((r) => clampStart(r))) : null;
const anchorMs =
ownDay && !ownDay.autoCheckedIn && ownDay.checkedInAt
? ownDay.checkedInAt.getTime()
: firstStartMs;
const entries = rows.map((r) => ({ const entries = rows.map((r) => ({
...r, ...r,
todoTitle: r.todoId ? (titles.get(r.todoId) ?? null) : null, todoTitle: r.todoId ? (titles.get(r.todoId) ?? null) : null,
})); }));
return { entries, totalSeconds, trackedSeconds }; return {
entries,
totalSeconds,
trackedSeconds,
presenceStartedAt: anchorMs !== null ? new Date(anchorMs).toISOString() : null,
presenceEndedAt: ownDay?.checkedOutAt ? ownDay.checkedOutAt.toISOString() : null,
};
}), }),
/** /**
@@ -199,7 +227,11 @@ export const timeRouter = router({
} }
const startedAt = input.startedAt ? new Date(input.startedAt) : existing.startedAt; const startedAt = input.startedAt ? new Date(input.startedAt) : existing.startedAt;
const endedAt = const endedAt =
input.endedAt === undefined ? existing.endedAt : input.endedAt === null ? null : new Date(input.endedAt); input.endedAt === undefined
? existing.endedAt
: input.endedAt === null
? null
: new Date(input.endedAt);
const durationSeconds = endedAt const durationSeconds = endedAt
? Math.max(0, Math.round((endedAt.getTime() - startedAt.getTime()) / 1000)) ? Math.max(0, Math.round((endedAt.getTime() - startedAt.getTime()) / 1000))
: null; : null;
@@ -211,8 +243,7 @@ export const timeRouter = router({
durationSeconds, durationSeconds,
todoId: input.todoId === undefined ? existing.todoId : input.todoId, todoId: input.todoId === undefined ? existing.todoId : input.todoId,
category: input.category ?? existing.category, category: input.category ?? existing.category,
description: description: input.description === undefined ? existing.description : input.description,
input.description === undefined ? existing.description : input.description,
updatedAt: new Date(), updatedAt: new Date(),
}) })
.where(eq(timeEntry.id, input.id)) .where(eq(timeEntry.id, input.id))
@@ -335,14 +366,37 @@ export const timeRouter = router({
perUser.set(r.userId, bucket); perUser.set(r.userId, bucket);
} }
// Anwesenheit (Lock-in → Feierabend) pro Person — reine Anzeige neben dem
// Tracking. Anker = echter Lock-in; bei vom 6-Uhr-Schnitt auto-angelegten
// Tagen (Check-in 06:00 ist kein echter Lock-in) stattdessen der erste
// Zeiteintrag des Tages.
const dayRows = await ctx.db
.select({
userId: dayEntry.userId,
checkedInAt: dayEntry.checkedInAt,
checkedOutAt: dayEntry.checkedOutAt,
autoCheckedIn: dayEntry.autoCheckedIn,
})
.from(dayEntry)
.where(eq(dayEntry.date, today));
const presenceByUser = new Map(dayRows.map((d) => [d.userId, d]));
// „Gesamt" pro Person = Wall-Clock (Vereinigung der Intervalle). // „Gesamt" pro Person = Wall-Clock (Vereinigung der Intervalle).
return Array.from(perUser.values()).map((b) => ({ return Array.from(perUser.values()).map((b) => {
const p = presenceByUser.get(b.userId);
const firstStartMs = b.intervals.length ? Math.min(...b.intervals.map((i) => i[0])) : null;
const anchorMs =
p && !p.autoCheckedIn && p.checkedInAt ? p.checkedInAt.getTime() : firstStartMs;
return {
userId: b.userId, userId: b.userId,
totalSeconds: unionSeconds(b.intervals), totalSeconds: unionSeconds(b.intervals),
trackedSeconds: b.trackedSeconds, trackedSeconds: b.trackedSeconds,
byCategory: b.byCategory, byCategory: b.byCategory,
active: b.active, active: b.active,
})); presenceStartedAt: anchorMs !== null ? new Date(anchorMs).toISOString() : null,
presenceEndedAt: p?.checkedOutAt ? p.checkedOutAt.toISOString() : null,
};
});
}), }),
/** /**
@@ -368,7 +422,9 @@ export const timeRouter = router({
.where(cond) .where(cond)
.orderBy(asc(timeEntry.startedAt)); .orderBy(asc(timeEntry.startedAt));
const todoIds = Array.from(new Set(rows.map((r) => r.todoId).filter((x): x is string => !!x))); const todoIds = Array.from(
new Set(rows.map((r) => r.todoId).filter((x): x is string => !!x)),
);
const titles = new Map<string, string>(); const titles = new Map<string, string>();
if (todoIds.length > 0) { if (todoIds.length > 0) {
const tr = await ctx.db const tr = await ctx.db
@@ -412,4 +468,38 @@ export const timeRouter = router({
return { date, lanes }; return { date, lanes };
}), }),
/**
* Getrackte Zeit auf ein Projekt (time_entry mit bezugKind='project'):
* Gesamtsumme + Aufschlüsselung pro Person. bezugId wurde bislang erfasst,
* aber nirgends ausgewertet — das speist die „Getrackte Zeit"-Sektion im
* Projekt-Detail.
*/
byProject: protectedProcedure
.input(z.object({ projectId: z.string().uuid() }))
.query(async ({ ctx, input }) => {
const rows = await ctx.db
.select({
userId: timeEntry.userId,
seconds: sql<number>`COALESCE(SUM(${timeEntry.durationSeconds}), 0)`,
})
.from(timeEntry)
.where(and(eq(timeEntry.bezugKind, 'project'), eq(timeEntry.bezugId, input.projectId)))
.groupBy(timeEntry.userId);
const userRows = await ctx.db.select({ id: user.id, name: user.name }).from(user);
const nameById = new Map(userRows.map((u) => [u.id, u.name]));
const perUser = rows
.map((r) => ({
userId: r.userId,
name: nameById.get(r.userId) ?? '—',
seconds: Number(r.seconds),
}))
.filter((r) => r.seconds > 0)
.sort((a, b) => b.seconds - a.seconds);
const totalSeconds = perUser.reduce((sum, r) => sum + r.seconds, 0);
return { totalSeconds, perUser };
}),
}); });
+23 -18
View File
@@ -3,8 +3,9 @@
import './types.js'; import './types.js';
import { initTRPC, TRPCError } from '@trpc/server'; import { initTRPC, TRPCError } from '@trpc/server';
import type { FastifyRequest, FastifyReply } from 'fastify'; import type { FastifyRequest, FastifyReply } from 'fastify';
import type { User } from '@cockpit/db'; import { auditEvent, type User } from '@cockpit/db';
import { getDb } from './db.js'; import { getDb } from './db.js';
import { logger } from './lib/logger.js';
export interface Context { export interface Context {
user: User | null; user: User | null;
@@ -45,25 +46,29 @@ export const protectedProcedure = t.procedure.use(async ({ ctx, next }) => {
return next({ ctx: { ...ctx, user: ctx.user } }); return next({ ctx: { ...ctx, user: ctx.user } });
}); });
// Audit-Wrapper: schreibt nach erfolgreicher Mutation einen audit_event. /**
// Genutzt als zusätzliche Middleware auf Mutations. * Auditierte Procedure: wie `protectedProcedure`, schreibt aber nach erfolgreicher
export function withAudit<TInput, TResult extends Record<string, unknown> | unknown>( * Ausführung einen `audit_event`. Nutzung:
action: string, * auditedProcedure('blocker.resolve').input(schema).mutation(...)
) { * Das Audit ist best-effort — ein Fehler beim Schreiben darf die eigentliche
return async function audit(opts: { * Mutation nicht scheitern lassen.
ctx: Context; */
input: TInput; export function auditedProcedure(action: string) {
next: () => Promise<{ ok: true; data: TResult } | TResult>; return protectedProcedure.use(async ({ ctx, next, getRawInput }) => {
}) { const result = await next();
const result = await opts.next(); if (result.ok) {
if (!opts.ctx.user) return result; try {
const { auditEvent } = await import('@cockpit/db'); const rawInput = await getRawInput();
await opts.ctx.db.insert(auditEvent).values({ await ctx.db.insert(auditEvent).values({
actorUserId: opts.ctx.user.id, actorUserId: ctx.user.id,
action, action,
entityKind: action.split('.')[0] ?? 'unknown', entityKind: action.split('.')[0] ?? 'unknown',
payload: { input: opts.input as unknown }, payload: { input: (rawInput ?? null) as unknown },
}); });
} catch (err) {
logger.warn({ err, action }, 'audit_event konnte nicht geschrieben werden');
}
}
return result; return result;
}; });
} }
+3
View File
@@ -1,12 +1,15 @@
import { Toaster } from 'sonner'; import { Toaster } from 'sonner';
import { TrpcProvider } from './lib/trpc-provider'; import { TrpcProvider } from './lib/trpc-provider';
import { Router } from './lib/router'; import { Router } from './lib/router';
import { ConfirmProvider } from './components/ui/ConfirmProvider';
export function App() { export function App() {
return ( return (
<TrpcProvider> <TrpcProvider>
<ConfirmProvider>
<Router /> <Router />
<Toaster position="bottom-right" richColors={false} /> <Toaster position="bottom-right" richColors={false} />
</ConfirmProvider>
</TrpcProvider> </TrpcProvider>
); );
} }
@@ -3,6 +3,7 @@ import { toast } from 'sonner';
import { trpc } from '../../lib/trpc'; import { trpc } from '../../lib/trpc';
import { voice } from '../../lib/voice'; import { voice } from '../../lib/voice';
import { Button } from '../ui/Button'; import { Button } from '../ui/Button';
import { Modal } from '../ui/Modal';
export function BlockerDialog({ onClose }: { onClose: () => void }) { export function BlockerDialog({ onClose }: { onClose: () => void }) {
const [title, setTitle] = useState(''); const [title, setTitle] = useState('');
@@ -23,15 +24,7 @@ export function BlockerDialog({ onClose }: { onClose: () => void }) {
} }
return ( return (
<div <Modal open onClose={onClose} title="Neuer Blocker">
className="fixed inset-0 z-50 flex items-center justify-center bg-black/30"
onClick={onClose}
>
<div
className="w-full max-w-md rounded-[var(--radius-xl)] bg-[var(--color-bg)] p-6 shadow-[var(--shadow-lg)]"
onClick={(e) => e.stopPropagation()}
>
<h2 className="text-xl font-semibold">Neuer Blocker</h2>
<form onSubmit={submit} className="mt-4 space-y-3"> <form onSubmit={submit} className="mt-4 space-y-3">
<label className="block"> <label className="block">
<span className="text-sm font-medium">Was klemmt?</span> <span className="text-sm font-medium">Was klemmt?</span>
@@ -65,7 +58,6 @@ export function BlockerDialog({ onClose }: { onClose: () => void }) {
</Button> </Button>
</div> </div>
</form> </form>
</div> </Modal>
</div>
); );
} }
@@ -3,10 +3,12 @@ import { useEffect, useState } from 'react';
import { TopNav } from './TopNav'; import { TopNav } from './TopNav';
import { useCurrentUser } from '../../hooks/useCurrentUser'; import { useCurrentUser } from '../../hooks/useCurrentUser';
import { BlockerDialog } from '../blocker/BlockerDialog'; import { BlockerDialog } from '../blocker/BlockerDialog';
import { CommandPalette } from '../search/CommandPalette';
const SHORTCUT_MAP: Record<string, string> = { const SHORTCUT_MAP: Record<string, string> = {
p: '/dashboard', p: '/dashboard',
h: '/heute', h: '/heute',
w: '/meine-woche',
b: '/bereich', b: '/bereich',
e: '/bereich/entwicklung', e: '/bereich/entwicklung',
v: '/bereich/vertrieb', v: '/bereich/vertrieb',
@@ -20,6 +22,7 @@ export function AppShell() {
const me = useCurrentUser(); const me = useCurrentUser();
const navigate = useNavigate(); const navigate = useNavigate();
const [blockerOpen, setBlockerOpen] = useState(false); const [blockerOpen, setBlockerOpen] = useState(false);
const [searchOpen, setSearchOpen] = useState(false);
// Dev-Mode: bei fehlender Session sofort in den Auto-Login. Auf prod hingegen // Dev-Mode: bei fehlender Session sofort in den Auto-Login. Auf prod hingegen
// zeigen wir die Login-Aufforderung mit dem Authentik-Link. // zeigen wir die Login-Aufforderung mit dem Authentik-Link.
@@ -49,6 +52,12 @@ export function AppShell() {
} }
function onKey(e: KeyboardEvent) { function onKey(e: KeyboardEvent) {
// Cmd/Ctrl+K öffnet die Suche — auch aus Eingabefeldern heraus.
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
e.preventDefault();
setSearchOpen(true);
return;
}
const target = e.target as HTMLElement | null; const target = e.target as HTMLElement | null;
if ( if (
target && target &&
@@ -56,6 +65,11 @@ export function AppShell() {
) { ) {
return; return;
} }
if (e.key === '/') {
e.preventDefault();
setSearchOpen(true);
return;
}
if (e.key === '?' && !waitingForSecond) { if (e.key === '?' && !waitingForSecond) {
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
alert( alert(
@@ -96,6 +110,7 @@ export function AppShell() {
{me ? <Outlet /> : <NotLoggedInHint />} {me ? <Outlet /> : <NotLoggedInHint />}
</main> </main>
{blockerOpen && <BlockerDialog onClose={() => setBlockerOpen(false)} />} {blockerOpen && <BlockerDialog onClose={() => setBlockerOpen(false)} />}
<CommandPalette open={searchOpen} onClose={() => setSearchOpen(false)} />
</div> </div>
); );
} }
+5 -1
View File
@@ -10,6 +10,7 @@ const TABS = [
{ to: '/dashboard', label: 'Dashboard', shortcut: 'g d', matchPrefix: '/dashboard' }, { to: '/dashboard', label: 'Dashboard', shortcut: 'g d', matchPrefix: '/dashboard' },
{ to: '/bereich', label: 'Bereich', shortcut: 'g b', matchPrefix: '/bereich' }, { to: '/bereich', label: 'Bereich', shortcut: 'g b', matchPrefix: '/bereich' },
{ to: '/heute', label: 'Heute', shortcut: 'g h', matchPrefix: '/heute' }, { to: '/heute', label: 'Heute', shortcut: 'g h', matchPrefix: '/heute' },
{ to: '/meine-woche', label: 'Woche', shortcut: 'g w', matchPrefix: '/meine-woche' },
{ to: '/team', label: 'Team', shortcut: 'g t', matchPrefix: '/team' }, { to: '/team', label: 'Team', shortcut: 'g t', matchPrefix: '/team' },
{ to: '/historie', label: 'Historie', shortcut: 'g i', matchPrefix: '/historie' }, { to: '/historie', label: 'Historie', shortcut: 'g i', matchPrefix: '/historie' },
{ to: '/archiv', label: 'Archiv', shortcut: 'g a', matchPrefix: '/archiv' }, { to: '/archiv', label: 'Archiv', shortcut: 'g a', matchPrefix: '/archiv' },
@@ -37,7 +38,10 @@ export function TopNav() {
className="mx-auto flex h-14 max-w-[1280px] items-center gap-2 px-6" className="mx-auto flex h-14 max-w-[1280px] items-center gap-2 px-6"
aria-label="Hauptnavigation" aria-label="Hauptnavigation"
> >
<NavLink to="/dashboard" className="flex items-center gap-1.5 font-bold text-[var(--color-ink)]"> <NavLink
to="/dashboard"
className="flex items-center gap-1.5 font-bold text-[var(--color-ink)]"
>
<span>{voice.appName}</span> <span>{voice.appName}</span>
<ToolCtrlLogo size={18} /> <ToolCtrlLogo size={18} />
</NavLink> </NavLink>
@@ -120,7 +120,9 @@ export function LogoUpload({
{error ? ( {error ? (
<span className="text-xs text-[var(--color-ampel-red-fg)]">{error}</span> <span className="text-xs text-[var(--color-ampel-red-fg)]">{error}</span>
) : ( ) : (
<span className="text-xs text-[var(--color-ink-faint)]">Quadratisch, wird auf 256px verkleinert.</span> <span className="text-xs text-[var(--color-ink-faint)]">
Quadratisch, wird auf 256px verkleinert.
</span>
)} )}
</div> </div>
<input <input
@@ -0,0 +1,106 @@
import { useEffect, useState, type ReactNode } from 'react';
import { useNavigate } from 'react-router';
import { trpc } from '../../lib/trpc';
import { Modal } from '../ui/Modal';
/**
* Globale Schnellsuche (Cmd/Ctrl+K oder „/"). Tippen sucht debounced über
* Projekte, Leads und offene Blocker; Klick springt zum Ziel.
*/
export function CommandPalette({ open, onClose }: { open: boolean; onClose: () => void }) {
const navigate = useNavigate();
const [q, setQ] = useState('');
const [debounced, setDebounced] = useState('');
useEffect(() => {
const t = setTimeout(() => setDebounced(q.trim()), 200);
return () => clearTimeout(t);
}, [q]);
useEffect(() => {
if (!open) {
setQ('');
setDebounced('');
}
}, [open]);
const results = trpc.search.all.useQuery(
{ q: debounced },
{ enabled: open && debounced.length >= 1 },
);
const data = results.data;
const empty =
!!data && data.projects.length === 0 && data.leads.length === 0 && data.blockers.length === 0;
function go(path: string) {
onClose();
navigate(path);
}
return (
<Modal open={open} onClose={onClose} title="Suche">
<input
type="text"
value={q}
onChange={(e) => setQ(e.target.value)}
placeholder="Projekt, Lead oder Blocker …"
className="mt-2 w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white px-3 py-2 text-sm focus:border-[var(--color-ink)] focus:outline-none"
/>
<div className="mt-3 max-h-80 space-y-3 overflow-y-auto text-sm">
{debounced.length >= 1 && empty && results.isFetched && (
<p className="text-[var(--color-ink-muted)]">Nichts gefunden.</p>
)}
{data && data.projects.length > 0 && (
<Group title="Projekte">
{data.projects.map((p) => (
<ResultItem
key={p.id}
label={p.archived ? `${p.label} (archiviert)` : p.label}
onClick={() => go(`/projekt/${p.id}`)}
/>
))}
</Group>
)}
{data && data.leads.length > 0 && (
<Group title="Leads">
{data.leads.map((l) => (
<ResultItem key={l.id} label={l.label} onClick={() => go(`/lead/${l.id}`)} />
))}
</Group>
)}
{data && data.blockers.length > 0 && (
<Group title="Offene Blocker">
{data.blockers.map((b) => (
<ResultItem key={b.id} label={b.label} onClick={() => go('/dashboard')} />
))}
</Group>
)}
</div>
</Modal>
);
}
function Group({ title, children }: { title: string; children: ReactNode }) {
return (
<div>
<p className="mb-1 text-xs font-medium uppercase tracking-wide text-[var(--color-ink-faint)]">
{title}
</p>
<ul className="space-y-0.5">{children}</ul>
</div>
);
}
function ResultItem({ label, onClick }: { label: string; onClick: () => void }) {
return (
<li>
<button
type="button"
onClick={onClick}
className="w-full truncate rounded-[var(--radius-sm)] px-2 py-1.5 text-left hover:bg-black/5"
>
{label}
</button>
</li>
);
}
@@ -28,6 +28,16 @@ function initials(name: string) {
.join(''); .join('');
} }
/** Anwesenheit (Lock-in → Feierabend bzw. jetzt) — reine Anzeige, kein Tracking. */
function presenceSecondsOf(it: {
presenceStartedAt: string | null;
presenceEndedAt: string | null;
}): number | null {
if (!it.presenceStartedAt) return null;
const endMs = it.presenceEndedAt ? new Date(it.presenceEndedAt).getTime() : Date.now();
return Math.max(0, Math.round((endMs - new Date(it.presenceStartedAt).getTime()) / 1000));
}
export function TeamTimeSection() { export function TeamTimeSection() {
const team = trpc.time.teamToday.useQuery(undefined, { refetchInterval: 30_000 }); const team = trpc.time.teamToday.useQuery(undefined, { refetchInterval: 30_000 });
const users = trpc.user.list.useQuery(); const users = trpc.user.list.useQuery();
@@ -85,7 +95,17 @@ export function TeamTimeSection() {
title="Über parallele Aufgaben getrackte Summe (zählt überlappende Zeit mehrfach)." title="Über parallele Aufgaben getrackte Summe (zählt überlappende Zeit mehrfach)."
> >
{' · getrackt '} {' · getrackt '}
<span className="font-mono">{formatDurationCompact(it.trackedSeconds)}</span> <span className="font-mono">
{formatDurationCompact(it.trackedSeconds)}
</span>
</span>
)}
{presenceSecondsOf(it) !== null && (
<span title="Anwesenheit: ab Lock-in (bzw. erstem Zeiteintrag des Tages) bis Feierabend bzw. jetzt — unabhängig vom Tracking.">
{' · Anwesend: '}
<span className="font-mono">
{formatDurationCompact(presenceSecondsOf(it)!)}
</span>
</span> </span>
)} )}
</p> </p>
@@ -131,18 +151,10 @@ function ActiveLine({
} }
function IdleLine() { function IdleLine() {
return ( return <p className="mt-3 text-xs text-[var(--color-ink-faint)]">Aktuell kein Timer.</p>;
<p className="mt-3 text-xs text-[var(--color-ink-faint)]">Aktuell kein Timer.</p>
);
} }
function Breakdown({ function Breakdown({ byCategory, total }: { byCategory: Record<string, number>; total: number }) {
byCategory,
total,
}: {
byCategory: Record<string, number>;
total: number;
}) {
if (total === 0) return null; if (total === 0) return null;
const ordered = TIME_CATEGORIES.map((c) => ({ const ordered = TIME_CATEGORIES.map((c) => ({
key: c.value, key: c.value,
@@ -1,11 +1,13 @@
import { useState } from 'react'; import { useState } from 'react';
import { Pencil, Trash2, Plus, X } from 'lucide-react'; import { Pencil, Trash2, Plus } from 'lucide-react';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { clsx } from 'clsx'; import { clsx } from 'clsx';
import { trpc } from '../../lib/trpc'; import { trpc } from '../../lib/trpc';
import { Card } from '../ui/Card'; import { Card } from '../ui/Card';
import { Button } from '../ui/Button'; import { Button } from '../ui/Button';
import { Modal } from '../ui/Modal';
import { formatDuration, formatDurationCompact } from '../../lib/format-duration'; import { formatDuration, formatDurationCompact } from '../../lib/format-duration';
import { usePresenceSeconds } from '../../lib/use-presence-seconds';
import { TIME_CATEGORIES, type TimeCategory } from '../../lib/time-categories'; import { TIME_CATEGORIES, type TimeCategory } from '../../lib/time-categories';
const CATEGORY_LABEL: Record<string, string> = Object.fromEntries( const CATEGORY_LABEL: Record<string, string> = Object.fromEntries(
@@ -29,6 +31,17 @@ export function TimelineSection() {
const todayQuery = trpc.dayEntry.today.useQuery(); const todayQuery = trpc.dayEntry.today.useQuery();
const [manualOpen, setManualOpen] = useState(false); const [manualOpen, setManualOpen] = useState(false);
const [editing, setEditing] = useState<string | null>(null); const [editing, setEditing] = useState<string | null>(null);
// Anwesenheits-Anker: echter Lock-in; bei Auto-Tagen (6-Uhr-Schnitt) liefert
// listToday den ersten Zeiteintrag des Tages als Fallback.
const todayEntry = todayQuery.data?.entry;
const presenceFrom =
todayEntry && !todayEntry.autoCheckedIn && todayEntry.checkedInAt
? todayEntry.checkedInAt
: (listQuery.data?.presenceStartedAt ?? null);
const presenceSeconds = usePresenceSeconds(
presenceFrom,
todayEntry?.checkedOutAt ?? listQuery.data?.presenceEndedAt ?? null,
);
if (listQuery.isPending) return null; if (listQuery.isPending) return null;
// Aufsteigend sortieren: Vormittag oben, Abend unten. // Aufsteigend sortieren: Vormittag oben, Abend unten.
@@ -44,7 +57,13 @@ export function TimelineSection() {
<div> <div>
<h2 className="text-lg font-semibold">Zeit heute</h2> <h2 className="text-lg font-semibold">Zeit heute</h2>
<p className="text-xs text-[var(--color-ink-muted)]"> <p className="text-xs text-[var(--color-ink-muted)]">
Gesamt: <span className="font-mono">{formatDurationCompact(totalSeconds)}</span> Getrackt: <span className="font-mono">{formatDurationCompact(totalSeconds)}</span>
{presenceSeconds !== null && (
<>
{' · '}Anwesend:{' '}
<span className="font-mono">{formatDurationCompact(presenceSeconds)}</span>
</>
)}
</p> </p>
</div> </div>
<Button size="sm" variant="secondary" onClick={() => setManualOpen(true)}> <Button size="sm" variant="secondary" onClick={() => setManualOpen(true)}>
@@ -80,10 +99,7 @@ export function TimelineSection() {
)} )}
{manualOpen && ( {manualOpen && (
<ManualDialog <ManualDialog onClose={() => setManualOpen(false)} todos={todayQuery.data?.todos ?? []} />
onClose={() => setManualOpen(false)}
todos={todayQuery.data?.todos ?? []}
/>
)} )}
</section> </section>
); );
@@ -258,7 +274,10 @@ function TimelineRow({
<p className="truncate">{label}</p> <p className="truncate">{label}</p>
<p className="text-xs text-[var(--color-ink-muted)]"> <p className="text-xs text-[var(--color-ink-muted)]">
{CATEGORY_LABEL[entry.category]} {CATEGORY_LABEL[entry.category]}
{entry.description && !todoTitle && entry.description !== label && ` · ${entry.description}`} {entry.description &&
!todoTitle &&
entry.description !== label &&
` · ${entry.description}`}
</p> </p>
</div> </div>
<div <div
@@ -270,7 +289,7 @@ function TimelineRow({
{formatDuration(duration)} {formatDuration(duration)}
</div> </div>
{!isRunning && ( {!isRunning && (
<div className="flex shrink-0 gap-1 opacity-0 group-hover:opacity-100"> <div className="flex shrink-0 gap-1 opacity-100 sm:opacity-0 sm:group-hover:opacity-100">
<button <button
type="button" type="button"
onClick={onEdit} onClick={onEdit}
@@ -333,25 +352,7 @@ export function ManualDialog({
} }
return ( return (
<div <Modal open onClose={onClose} title="Block nachtragen">
className="fixed inset-0 z-50 flex items-center justify-center bg-black/30"
onClick={onClose}
>
<div
className="w-full max-w-md rounded-[var(--radius-xl)] bg-[var(--color-bg)] p-6 shadow-[var(--shadow-lg)]"
onClick={(e) => e.stopPropagation()}
>
<div className="flex items-center justify-between">
<h2 className="text-xl font-semibold">Block nachtragen</h2>
<button
type="button"
onClick={onClose}
aria-label="Schließen"
className="rounded-[var(--radius-sm)] p-1 text-[var(--color-ink-muted)] hover:bg-black/5"
>
<X size={16} />
</button>
</div>
<form onSubmit={submit} className="mt-4 space-y-3"> <form onSubmit={submit} className="mt-4 space-y-3">
<div className="grid grid-cols-2 gap-2"> <div className="grid grid-cols-2 gap-2">
<label className="block"> <label className="block">
@@ -423,7 +424,6 @@ export function ManualDialog({
</Button> </Button>
</div> </div>
</form> </form>
</div> </Modal>
</div>
); );
} }
+3 -1
View File
@@ -243,7 +243,9 @@ function QuickPicker({
<button <button
key={c.value} key={c.value}
type="button" type="button"
onClick={() => onStart({ category: c.value, description: description.trim() || undefined })} onClick={() =>
onStart({ category: c.value, description: description.trim() || undefined })
}
disabled={pending} disabled={pending}
className="flex w-full items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 text-left text-sm hover:bg-black/5" className="flex w-full items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 text-left text-sm hover:bg-black/5"
> >
+1 -4
View File
@@ -5,10 +5,7 @@ function Root({ className, ...rest }: HTMLAttributes<HTMLDivElement>) {
// Scharfe Kanten, Haarlinien-Rahmen ohne Schatten — ToolCTRL-Website-Stil. // Scharfe Kanten, Haarlinien-Rahmen ohne Schatten — ToolCTRL-Website-Stil.
return ( return (
<div <div
className={clsx( className={clsx('bg-[var(--color-surface)] border border-[var(--color-border)]', className)}
'bg-[var(--color-surface)] border border-[var(--color-border)]',
className,
)}
{...rest} {...rest}
/> />
); );
@@ -0,0 +1,69 @@
import { createContext, useCallback, useContext, useRef, useState, type ReactNode } from 'react';
import { Modal } from './Modal';
import { Button } from './Button';
export type ConfirmOptions = {
title: string;
message?: ReactNode;
confirmLabel?: string;
cancelLabel?: string;
destructive?: boolean;
};
type ConfirmFn = (opts: ConfirmOptions) => Promise<boolean>;
const ConfirmContext = createContext<ConfirmFn | null>(null);
/**
* Imperative Bestätigung: `const confirm = useConfirm(); if (await confirm({...})) …`.
* Ersetzt window.confirm() durch einen gestylten, barrierearmen Dialog.
*/
export function useConfirm(): ConfirmFn {
const ctx = useContext(ConfirmContext);
if (!ctx) throw new Error('useConfirm muss innerhalb von <ConfirmProvider> stehen.');
return ctx;
}
export function ConfirmProvider({ children }: { children: ReactNode }) {
const [opts, setOpts] = useState<ConfirmOptions | null>(null);
const resolver = useRef<((v: boolean) => void) | null>(null);
const confirm = useCallback<ConfirmFn>((options) => {
setOpts(options);
return new Promise<boolean>((resolve) => {
resolver.current = resolve;
});
}, []);
const settle = useCallback((result: boolean) => {
resolver.current?.(result);
resolver.current = null;
setOpts(null);
}, []);
return (
<ConfirmContext.Provider value={confirm}>
{children}
<Modal open={opts !== null} onClose={() => settle(false)} title={opts?.title} size="sm">
{opts && (
<>
{opts.message != null && (
<div className="mt-2 text-sm text-[var(--color-ink-muted)]">{opts.message}</div>
)}
<div className="mt-5 flex justify-end gap-2">
<Button variant="ghost" onClick={() => settle(false)}>
{opts.cancelLabel ?? 'Abbrechen'}
</Button>
<Button
variant={opts.destructive ? 'destructive' : 'primary'}
onClick={() => settle(true)}
>
{opts.confirmLabel ?? 'OK'}
</Button>
</div>
</>
)}
</Modal>
</ConfirmContext.Provider>
);
}
+24
View File
@@ -0,0 +1,24 @@
import { Button } from './Button';
/**
* Einheitlicher Fehlerzustand für fehlgeschlagene Queries — ersetzt stilles
* `return null` (weiße Leerseite) durch einen Hinweis + optionalen Retry.
*/
export function ErrorState({
message = 'Konnte nicht geladen werden.',
onRetry,
}: {
message?: string;
onRetry?: () => void;
}) {
return (
<div className="mx-auto max-w-md rounded-[var(--radius-lg)] border border-[var(--color-border)] bg-[var(--color-bg)] p-6 text-center">
<p className="text-sm text-[var(--color-ink-muted)]">{message}</p>
{onRetry && (
<Button variant="secondary" size="sm" className="mt-3" onClick={onRetry}>
Neu laden
</Button>
)}
</div>
);
}
+118
View File
@@ -0,0 +1,118 @@
import { useEffect, useId, useRef, type ReactNode } from 'react';
import { createPortal } from 'react-dom';
import { X } from 'lucide-react';
type Size = 'sm' | 'md' | 'lg';
const maxWidth: Record<Size, string> = {
sm: 'max-w-sm',
md: 'max-w-md',
lg: 'max-w-2xl',
};
/**
* Barrierearmer Basis-Dialog: role=dialog/aria-modal, Fokus in den Dialog beim
* Öffnen, Fokus-Trap (Tab zyklisch), Escape zum Schließen, Fokus-Rückgabe ans
* vorher fokussierte Element, Body-Scroll-Lock. Klick aufs Overlay schließt.
* Alle App-Dialoge sollen hierauf aufsetzen.
*/
export function Modal({
open,
onClose,
title,
children,
size = 'md',
}: {
open: boolean;
onClose: () => void;
title?: ReactNode;
children: ReactNode;
size?: Size;
}) {
const panelRef = useRef<HTMLDivElement>(null);
const restoreFocus = useRef<HTMLElement | null>(null);
const titleId = useId();
useEffect(() => {
if (!open) return;
restoreFocus.current = document.activeElement as HTMLElement | null;
const panel = panelRef.current;
const focusableSel =
'input:not([disabled]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])';
const first = panel?.querySelector<HTMLElement>(focusableSel);
(first ?? panel)?.focus();
function onKey(e: KeyboardEvent) {
if (e.key === 'Escape') {
e.preventDefault();
onClose();
return;
}
if (e.key !== 'Tab' || !panel) return;
const nodes = Array.from(panel.querySelectorAll<HTMLElement>(focusableSel));
if (nodes.length === 0) {
e.preventDefault();
return;
}
const firstEl = nodes[0]!;
const lastEl = nodes[nodes.length - 1]!;
if (e.shiftKey && document.activeElement === firstEl) {
e.preventDefault();
lastEl.focus();
} else if (!e.shiftKey && document.activeElement === lastEl) {
e.preventDefault();
firstEl.focus();
}
}
document.addEventListener('keydown', onKey);
const prevOverflow = document.body.style.overflow;
document.body.style.overflow = 'hidden';
return () => {
document.removeEventListener('keydown', onKey);
document.body.style.overflow = prevOverflow;
restoreFocus.current?.focus?.();
};
}, [open, onClose]);
if (!open) return null;
return createPortal(
// Overlay-Klick schließt (reiner Maus-Komfort); Tastatur/Screenreader nutzen
// Escape und den Abbrechen-Button — daher ist die A11y-Regel hier ein false-positive.
// Overlay-Klick (nur direkt aufs Overlay, nicht aufs Panel) schließt — reiner
// Maus-Komfort; Tastatur/Screenreader nutzen Escape und den Abbrechen-Button.
<div
className="fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4"
onClick={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
<div
ref={panelRef}
role="dialog"
aria-modal="true"
aria-labelledby={title != null ? titleId : undefined}
tabIndex={-1}
className={`relative max-h-[90vh] w-full ${maxWidth[size]} overflow-y-auto rounded-[var(--radius-xl)] bg-[var(--color-bg)] p-6 shadow-[var(--shadow-lg)] focus:outline-none`}
>
<button
type="button"
onClick={onClose}
aria-label="Schließen"
className="absolute right-4 top-4 rounded-[var(--radius-sm)] p-1 text-[var(--color-ink-muted)] hover:bg-black/5 hover:text-[var(--color-ink)]"
>
<X size={18} />
</button>
{title != null && (
<h2 id={titleId} className="pr-8 text-xl font-semibold">
{title}
</h2>
)}
{children}
</div>
</div>,
document.body,
);
}
+1 -4
View File
@@ -2,10 +2,7 @@
export type LeadStatus = 'cold' | 'warm' | 'hot' | 'won' | 'lost'; export type LeadStatus = 'cold' | 'warm' | 'hot' | 'won' | 'lost';
export const LEAD_STATUS_META: Record< export const LEAD_STATUS_META: Record<LeadStatus, { label: string; badge: string; dot: string }> = {
LeadStatus,
{ label: string; badge: string; dot: string }
> = {
cold: { cold: {
label: 'Cold', label: 'Cold',
badge: 'bg-black/5 text-[var(--color-ink-muted)]', badge: 'bg-black/5 text-[var(--color-ink-muted)]',
+30 -7
View File
@@ -29,8 +29,14 @@ export const MODI: ProjectModus[] = ['relax', 'standard', 'eskalation', 'taskfor
export type Level = 'niedrig' | 'mittel' | 'hoch'; export type Level = 'niedrig' | 'mittel' | 'hoch';
export const LEVEL_META: Record<Level, { label: string; badge: string }> = { export const LEVEL_META: Record<Level, { label: string; badge: string }> = {
niedrig: { label: 'Niedrig', badge: 'bg-[var(--color-ampel-green-bg)] text-[var(--color-ampel-green-fg)]' }, niedrig: {
mittel: { label: 'Mittel', badge: 'bg-[var(--color-ampel-amber-bg)] text-[var(--color-ampel-amber-fg)]' }, label: 'Niedrig',
badge: 'bg-[var(--color-ampel-green-bg)] text-[var(--color-ampel-green-fg)]',
},
mittel: {
label: 'Mittel',
badge: 'bg-[var(--color-ampel-amber-bg)] text-[var(--color-ampel-amber-fg)]',
},
hoch: { label: 'Hoch', badge: 'bg-[var(--color-ampel-red-bg)] text-[var(--color-ampel-red-fg)]' }, hoch: { label: 'Hoch', badge: 'bg-[var(--color-ampel-red-bg)] text-[var(--color-ampel-red-fg)]' },
}; };
export const LEVELS: Level[] = ['niedrig', 'mittel', 'hoch']; export const LEVELS: Level[] = ['niedrig', 'mittel', 'hoch'];
@@ -66,7 +72,10 @@ export type ProjectPhase = 'definition' | 'planung' | 'umsetzung' | 'abschluss';
export const PHASES: ProjectPhase[] = ['definition', 'planung', 'umsetzung', 'abschluss']; export const PHASES: ProjectPhase[] = ['definition', 'planung', 'umsetzung', 'abschluss'];
export const PHASE_META: Record<ProjectPhase, { label: string; gateZiel: string }> = { export const PHASE_META: Record<ProjectPhase, { label: string; gateZiel: string }> = {
definition: { label: 'Definition', gateZiel: 'Steckbrief abgestimmt und freigegeben' }, definition: { label: 'Definition', gateZiel: 'Steckbrief abgestimmt und freigegeben' },
planung: { label: 'Planung', gateZiel: 'Plan steht — Backlog zerlegt, Meilensteine & Risiken erfasst' }, planung: {
label: 'Planung',
gateZiel: 'Plan steht — Backlog zerlegt, Meilensteine & Risiken erfasst',
},
umsetzung: { label: 'Umsetzung', gateZiel: 'Liefergegenstände abgenommen' }, umsetzung: { label: 'Umsetzung', gateZiel: 'Liefergegenstände abgenommen' },
abschluss: { label: 'Abschluss', gateZiel: 'Projekt beendet, Erkenntnisse gesichert' }, abschluss: { label: 'Abschluss', gateZiel: 'Projekt beendet, Erkenntnisse gesichert' },
}; };
@@ -86,12 +95,26 @@ export const RISK_STRATEGIE_LABEL: Record<RiskStrategie, string> = {
mindern: 'Mindern', mindern: 'Mindern',
akzeptieren: 'Akzeptieren', akzeptieren: 'Akzeptieren',
}; };
export const RISK_STRATEGIEN: RiskStrategie[] = ['vermeiden', 'verlagern', 'mindern', 'akzeptieren']; export const RISK_STRATEGIEN: RiskStrategie[] = [
'vermeiden',
'verlagern',
'mindern',
'akzeptieren',
];
export type ChangeEntscheidung = 'offen' | 'genehmigt' | 'abgelehnt'; export type ChangeEntscheidung = 'offen' | 'genehmigt' | 'abgelehnt';
export const CHANGE_ENTSCHEIDUNG_META: Record<ChangeEntscheidung, { label: string; badge: string }> = { export const CHANGE_ENTSCHEIDUNG_META: Record<
offen: { label: 'Offen', badge: 'bg-[var(--color-ampel-amber-bg)] text-[var(--color-ampel-amber-fg)]' }, ChangeEntscheidung,
genehmigt: { label: 'Genehmigt', badge: 'bg-[var(--color-ampel-green-bg)] text-[var(--color-ampel-green-fg)]' }, { label: string; badge: string }
> = {
offen: {
label: 'Offen',
badge: 'bg-[var(--color-ampel-amber-bg)] text-[var(--color-ampel-amber-fg)]',
},
genehmigt: {
label: 'Genehmigt',
badge: 'bg-[var(--color-ampel-green-bg)] text-[var(--color-ampel-green-fg)]',
},
abgelehnt: { label: 'Abgelehnt', badge: 'bg-black/5 text-[var(--color-ink-faint)]' }, abgelehnt: { label: 'Abgelehnt', badge: 'bg-black/5 text-[var(--color-ink-faint)]' },
}; };
export const CHANGE_ENTSCHEIDUNGEN: ChangeEntscheidung[] = ['offen', 'genehmigt', 'abgelehnt']; export const CHANGE_ENTSCHEIDUNGEN: ChangeEntscheidung[] = ['offen', 'genehmigt', 'abgelehnt'];
+17 -3
View File
@@ -43,7 +43,9 @@ if (typeof window !== 'undefined') {
const Dashboard = lazyWithReload(() => const Dashboard = lazyWithReload(() =>
import('../routes/dashboard').then((m) => ({ default: m.DashboardRoute })), import('../routes/dashboard').then((m) => ({ default: m.DashboardRoute })),
); );
const Heute = lazyWithReload(() => import('../routes/heute').then((m) => ({ default: m.HeuteRoute }))); const Heute = lazyWithReload(() =>
import('../routes/heute').then((m) => ({ default: m.HeuteRoute })),
);
const Reflexion = lazyWithReload(() => const Reflexion = lazyWithReload(() =>
import('../routes/reflexion').then((m) => ({ default: m.ReflexionRoute })), import('../routes/reflexion').then((m) => ({ default: m.ReflexionRoute })),
); );
@@ -53,7 +55,9 @@ const Bereich = lazyWithReload(() =>
const Projekt = lazyWithReload(() => const Projekt = lazyWithReload(() =>
import('../routes/projekt').then((m) => ({ default: m.ProjektRoute })), import('../routes/projekt').then((m) => ({ default: m.ProjektRoute })),
); );
const Leads = lazyWithReload(() => import('../routes/leads').then((m) => ({ default: m.LeadsRoute }))); const Leads = lazyWithReload(() =>
import('../routes/leads').then((m) => ({ default: m.LeadsRoute })),
);
const Lead = lazyWithReload(() => import('../routes/lead').then((m) => ({ default: m.LeadRoute }))); const Lead = lazyWithReload(() => import('../routes/lead').then((m) => ({ default: m.LeadRoute })));
const TeamView = lazyWithReload(() => const TeamView = lazyWithReload(() =>
import('../routes/team-view').then((m) => ({ default: m.TeamViewRoute })), import('../routes/team-view').then((m) => ({ default: m.TeamViewRoute })),
@@ -64,10 +68,18 @@ const Historie = lazyWithReload(() =>
const Archiv = lazyWithReload(() => const Archiv = lazyWithReload(() =>
import('../routes/archiv').then((m) => ({ default: m.ArchivRoute })), import('../routes/archiv').then((m) => ({ default: m.ArchivRoute })),
); );
const Pipeline = lazyWithReload(() =>
import('../routes/pipeline').then((m) => ({ default: m.PipelineRoute })),
);
const MeineWoche = lazyWithReload(() =>
import('../routes/meine-woche').then((m) => ({ default: m.MeineWocheRoute })),
);
const NotFound = lazyWithReload(() => const NotFound = lazyWithReload(() =>
import('../routes/not-found').then((m) => ({ default: m.NotFoundRoute })), import('../routes/not-found').then((m) => ({ default: m.NotFoundRoute })),
); );
const Login = lazyWithReload(() => import('../routes/login').then((m) => ({ default: m.LoginRoute }))); const Login = lazyWithReload(() =>
import('../routes/login').then((m) => ({ default: m.LoginRoute })),
);
function withSuspense(node: React.ReactNode) { function withSuspense(node: React.ReactNode) {
return ( return (
@@ -103,11 +115,13 @@ const router = createBrowserRouter([
{ index: true, element: withSuspense(<Dashboard />) }, { index: true, element: withSuspense(<Dashboard />) },
{ path: 'dashboard', element: withSuspense(<Dashboard />) }, { path: 'dashboard', element: withSuspense(<Dashboard />) },
{ path: 'heute', element: withSuspense(<Heute />) }, { path: 'heute', element: withSuspense(<Heute />) },
{ path: 'meine-woche', element: withSuspense(<MeineWoche />) },
{ path: 'reflexion', element: withSuspense(<Reflexion />) }, { path: 'reflexion', element: withSuspense(<Reflexion />) },
{ path: 'bereich', element: withSuspense(<Bereich />) }, { path: 'bereich', element: withSuspense(<Bereich />) },
{ path: 'bereich/:slug', element: withSuspense(<Bereich />) }, { path: 'bereich/:slug', element: withSuspense(<Bereich />) },
{ path: 'projekt/:id', element: withSuspense(<Projekt />) }, { path: 'projekt/:id', element: withSuspense(<Projekt />) },
{ path: 'leads', element: withSuspense(<Leads />) }, { path: 'leads', element: withSuspense(<Leads />) },
{ path: 'pipeline', element: withSuspense(<Pipeline />) },
{ path: 'lead/:id', element: withSuspense(<Lead />) }, { path: 'lead/:id', element: withSuspense(<Lead />) },
{ path: 'team', element: withSuspense(<TeamView />) }, { path: 'team', element: withSuspense(<TeamView />) },
{ path: 'historie', element: withSuspense(<Historie />) }, { path: 'historie', element: withSuspense(<Historie />) },
+22
View File
@@ -0,0 +1,22 @@
import { useEffect, useState } from 'react';
/**
* Anwesenheits-Sekunden von Lock-in bis Feierabend — bzw. bis jetzt, solange
* noch kein Check-Out vorliegt. Reine Anzeige, unabhängig vom Task-Tracking.
* Tickt minütlich, solange der Tag noch läuft.
*/
export function usePresenceSeconds(
checkedInAt: string | Date | null | undefined,
checkedOutAt: string | Date | null | undefined,
): number | null {
const running = Boolean(checkedInAt) && !checkedOutAt;
const [nowMs, setNowMs] = useState(() => Date.now());
useEffect(() => {
if (!running) return;
const id = setInterval(() => setNowMs(Date.now()), 60_000);
return () => clearInterval(id);
}, [running]);
if (!checkedInAt) return null;
const endMs = checkedOutAt ? new Date(checkedOutAt).getTime() : nowMs;
return Math.max(0, Math.round((endMs - new Date(checkedInAt).getTime()) / 1000));
}
+11 -17
View File
@@ -4,6 +4,7 @@ import { trpc } from '../lib/trpc';
import { voice } from '../lib/voice'; import { voice } from '../lib/voice';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
import { Button } from '../components/ui/Button'; import { Button } from '../components/ui/Button';
import { Modal } from '../components/ui/Modal';
import { SkeletonCard } from '../components/ui/SkeletonCard'; import { SkeletonCard } from '../components/ui/SkeletonCard';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { clsx } from 'clsx'; import { clsx } from 'clsx';
@@ -220,15 +221,7 @@ function ProjectCreateDialog({
}); });
} }
return ( return (
<div <Modal open onClose={onClose} title="Neues Projekt">
className="fixed inset-0 z-50 flex items-center justify-center bg-black/30"
onClick={onClose}
>
<div
className="w-full max-w-md rounded-[var(--radius-xl)] bg-[var(--color-bg)] p-6 shadow-[var(--shadow-lg)]"
onClick={(e) => e.stopPropagation()}
>
<h2 className="text-xl font-semibold">Neues Projekt</h2>
<form onSubmit={submit} className="mt-4 space-y-3"> <form onSubmit={submit} className="mt-4 space-y-3">
<Field label="Name"> <Field label="Name">
<input <input
@@ -307,8 +300,7 @@ function ProjectCreateDialog({
</Button> </Button>
</div> </div>
</form> </form>
</div> </Modal>
</div>
); );
} }
@@ -373,14 +365,15 @@ function LeadsTeaser() {
const q = trpc.lead.list.useQuery(); const q = trpc.lead.list.useQuery();
const leads = q.data ?? []; const leads = q.data ?? [];
const offen = leads.filter((l) => l.status !== 'won' && l.status !== 'lost'); const offen = leads.filter((l) => l.status !== 'won' && l.status !== 'lost');
const top = [...offen] const top = [...offen].sort((a, b) => b.score - a.score).slice(0, 3);
.sort((a, b) => b.score - a.score)
.slice(0, 3);
return ( return (
<section> <section>
<div className="mb-2 flex items-center justify-between"> <div className="mb-2 flex items-center justify-between">
<h2 className="text-lg font-semibold">Leads</h2> <h2 className="text-lg font-semibold">Leads</h2>
<Link to="/leads" className="text-sm text-[var(--color-ink-muted)] hover:text-[var(--color-ink)] hover:underline"> <Link
to="/leads"
className="text-sm text-[var(--color-ink-muted)] hover:text-[var(--color-ink)] hover:underline"
>
Alle Leads ({leads.length}) → Alle Leads ({leads.length}) →
</Link> </Link>
</div> </div>
@@ -409,7 +402,9 @@ function LeadsTeaser() {
<span className={clsx('h-2 w-2 rounded-full', meta.dot)} /> <span className={clsx('h-2 w-2 rounded-full', meta.dot)} />
<span className="font-medium">{l.firma}</span> <span className="font-medium">{l.firma}</span>
{l.subSegment && ( {l.subSegment && (
<span className="text-xs text-[var(--color-ink-muted)]">{l.subSegment}</span> <span className="text-xs text-[var(--color-ink-muted)]">
{l.subSegment}
</span>
)} )}
</span> </span>
<span className="font-mono text-xs tabular-nums text-[var(--color-ink-muted)]"> <span className="font-mono text-xs tabular-nums text-[var(--color-ink-muted)]">
@@ -456,4 +451,3 @@ function ProjektListeFuerBereich({ slug }: { slug: 'vertrieb' | 'marketing' }) {
</div> </div>
); );
} }
+18 -4
View File
@@ -4,6 +4,7 @@ import { voice } from '../lib/voice';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
import { Button } from '../components/ui/Button'; import { Button } from '../components/ui/Button';
import { SkeletonCard } from '../components/ui/SkeletonCard'; import { SkeletonCard } from '../components/ui/SkeletonCard';
import { ErrorState } from '../components/ui/ErrorState';
import { TeamTimeSection } from '../components/time/TeamTimeSection'; import { TeamTimeSection } from '../components/time/TeamTimeSection';
import { MODUS_META, type ProjectModus } from '../lib/project-meta'; import { MODUS_META, type ProjectModus } from '../lib/project-meta';
import { AlertTriangle } from 'lucide-react'; import { AlertTriangle } from 'lucide-react';
@@ -23,7 +24,13 @@ export function DashboardRoute() {
</div> </div>
); );
} }
if (!q.data) return null; if (q.isError || !q.data)
return (
<ErrorState
message="Dashboard konnte nicht geladen werden."
onRetry={() => void q.refetch()}
/>
);
const isCheckedIn = const isCheckedIn =
today.data?.entry?.status !== undefined && today.data.entry.status !== 'absent'; today.data?.entry?.status !== undefined && today.data.entry.status !== 'absent';
@@ -99,7 +106,9 @@ export function DashboardRoute() {
{m.ueberfaellig && ' · überfällig'} {m.ueberfaellig && ' · überfällig'}
</span> </span>
<span className="text-[var(--color-ink-faint)]">·</span> <span className="text-[var(--color-ink-faint)]">·</span>
<span className="text-[var(--color-ink-muted)]">{relativeDays(m.due!, q.data.date)}</span> <span className="text-[var(--color-ink-muted)]">
{relativeDays(m.due!, q.data.date)}
</span>
</div> </div>
</div> </div>
<Link <Link
@@ -202,7 +211,10 @@ export function DashboardRoute() {
<ul className="space-y-1 text-sm"> <ul className="space-y-1 text-sm">
{q.data.pflichtMinimumOffen.map((p) => ( {q.data.pflichtMinimumOffen.map((p) => (
<li key={p.id}> <li key={p.id}>
<Link to={`/projekt/${p.id}`} className="inline-flex items-center gap-2 hover:underline"> <Link
to={`/projekt/${p.id}`}
className="inline-flex items-center gap-2 hover:underline"
>
<ProjectLogo url={p.logoUrl} name={p.name} size={20} /> <ProjectLogo url={p.logoUrl} name={p.name} size={20} />
{p.name} {p.name}
</Link> </Link>
@@ -324,7 +336,9 @@ function TeamHeuteSection() {
</span> </span>
</div> </div>
{u.todos.length === 0 ? ( {u.todos.length === 0 ? (
<p className="mt-2 text-xs text-[var(--color-ink-faint)]">Keine ToDos eingetragen.</p> <p className="mt-2 text-xs text-[var(--color-ink-faint)]">
Keine ToDos eingetragen.
</p>
) : ( ) : (
<ul className="mt-2 space-y-1.5 text-sm"> <ul className="mt-2 space-y-1.5 text-sm">
{u.todos.map((t) => ( {u.todos.map((t) => (
+167 -16
View File
@@ -4,11 +4,13 @@ import { trpc } from '../lib/trpc';
import { voice } from '../lib/voice'; import { voice } from '../lib/voice';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
import { Button } from '../components/ui/Button'; import { Button } from '../components/ui/Button';
import { Modal } from '../components/ui/Modal';
import { SkeletonCard } from '../components/ui/SkeletonCard'; import { SkeletonCard } from '../components/ui/SkeletonCard';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { X, Plus, RotateCw, BellRing, Play, Clock, Check, LogOut } from 'lucide-react'; import { X, Plus, RotateCw, BellRing, Play, Clock, Check, LogOut } from 'lucide-react';
import { TimelineSection, ManualDialog } from '../components/time/TimelineSection'; import { TimelineSection, ManualDialog } from '../components/time/TimelineSection';
import { formatDurationCompact } from '../lib/format-duration'; import { formatDurationCompact } from '../lib/format-duration';
import { usePresenceSeconds } from '../lib/use-presence-seconds';
/** Aktuelle Stunde in Europe/Berlin (0–23). */ /** Aktuelle Stunde in Europe/Berlin (0–23). */
function berlinHourNow(): number { function berlinHourNow(): number {
@@ -218,9 +220,7 @@ function TodoRow({
<span className={dotClass} /> <span className={dotClass} />
<span <span
className={ className={
todo.status === 'dropped' todo.status === 'dropped' ? 'flex-1 line-through text-[var(--color-ink-muted)]' : 'flex-1'
? 'flex-1 line-through text-[var(--color-ink-muted)]'
: 'flex-1'
} }
> >
{todo.title} {todo.title}
@@ -243,7 +243,7 @@ function TodoRow({
className={ className={
isRunningHere isRunningHere
? 'inline-flex h-7 items-center gap-1 rounded-full bg-[var(--color-ampel-red-bg)] px-2 text-xs font-medium text-[var(--color-ampel-red-fg)]' ? 'inline-flex h-7 items-center gap-1 rounded-full bg-[var(--color-ampel-red-bg)] px-2 text-xs font-medium text-[var(--color-ampel-red-fg)]'
: 'inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--color-ink-muted)] opacity-0 hover:bg-black/5 hover:text-[var(--color-ink)] group-hover:opacity-100' : 'inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--color-ink-muted)] opacity-100 hover:bg-black/5 hover:text-[var(--color-ink)] sm:opacity-0 sm:group-hover:opacity-100'
} }
> >
{isRunningHere ? ( {isRunningHere ? (
@@ -265,7 +265,7 @@ function TodoRow({
onClick={() => setRetroOpen(true)} onClick={() => setRetroOpen(true)}
aria-label="Zeit nachtragen" aria-label="Zeit nachtragen"
title="Zeit nachtragen" title="Zeit nachtragen"
className="inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--color-ink-muted)] opacity-0 hover:bg-black/5 hover:text-[var(--color-ink)] group-hover:opacity-100" className="inline-flex h-7 w-7 items-center justify-center rounded-full text-[var(--color-ink-muted)] opacity-100 hover:bg-black/5 hover:text-[var(--color-ink)] sm:opacity-0 sm:group-hover:opacity-100"
> >
<Clock size={12} /> <Clock size={12} />
</button> </button>
@@ -320,18 +320,34 @@ function AddTodoInline() {
function CheckInOutBar({ function CheckInOutBar({
checkedInAt, checkedInAt,
checkedOutAt, checkedOutAt,
autoCheckedIn,
todos,
reflected,
}: { }: {
checkedInAt: string | Date | null; checkedInAt: string | Date | null;
checkedOutAt: string | Date | null; checkedOutAt: string | Date | null;
autoCheckedIn: boolean;
todos: Array<{ id: string; title: string; status: 'open' | 'done' | 'dropped' }>;
reflected: boolean;
}) { }) {
const utils = trpc.useUtils(); const utils = trpc.useUtils();
const [confirmOpen, setConfirmOpen] = useState(false);
const checkOut = trpc.dayEntry.checkOut.useMutation({ const checkOut = trpc.dayEntry.checkOut.useMutation({
onSuccess: async () => { onSuccess: async () => {
setConfirmOpen(false);
toast('Feierabend — Check-Out gespeichert.'); toast('Feierabend — Check-Out gespeichert.');
await utils.dayEntry.today.invalidate(); await utils.dayEntry.today.invalidate();
await utils.dashboard.overview.invalidate(); await utils.dashboard.overview.invalidate();
}, },
}); });
const reopen = trpc.dayEntry.reopen.useMutation({
onSuccess: async () => {
toast('Willkommen zurück — Arbeit fortgesetzt.');
await utils.dayEntry.today.invalidate();
await utils.dashboard.overview.invalidate();
},
onError: (err) => toast(err.message),
});
const hhmm = (d: string | Date | null) => const hhmm = (d: string | Date | null) =>
d d
? new Intl.DateTimeFormat('de-DE', { ? new Intl.DateTimeFormat('de-DE', {
@@ -340,35 +356,158 @@ function CheckInOutBar({
minute: '2-digit', minute: '2-digit',
}).format(new Date(d)) }).format(new Date(d))
: '—'; : '—';
const duration = // Anwesenheit (Lock-in → Feierabend bzw. jetzt) — reine Anzeige, kein Tracking.
checkedInAt && checkedOutAt // Auto-Check-in vom 6-Uhr-Schnitt ist kein echter Lock-in → Fallback-Anker
? formatDurationCompact( // (erster Zeiteintrag des Tages) aus listToday.
Math.max(0, Math.round((new Date(checkedOutAt).getTime() - new Date(checkedInAt).getTime()) / 1000)), const listToday = trpc.time.listToday.useQuery(undefined, { refetchInterval: 30_000 });
) const presenceFrom =
: null; !autoCheckedIn && checkedInAt ? checkedInAt : (listToday.data?.presenceStartedAt ?? null);
const presenceSeconds = usePresenceSeconds(presenceFrom, checkedOutAt);
return ( return (
<>
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-[var(--radius-md)] border border-[var(--color-border)] px-4 py-2 text-sm"> <div className="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-[var(--radius-md)] border border-[var(--color-border)] px-4 py-2 text-sm">
<span> <span>
Arbeitsantritt <span className="font-mono">{hhmm(checkedInAt)}</span> Arbeitsantritt <span className="font-mono">{hhmm(checkedInAt)}</span>
</span> </span>
{checkedOutAt ? ( {checkedOutAt ? (
<>
<span className="text-[var(--color-ink-muted)]"> <span className="text-[var(--color-ink-muted)]">
· Feierabend <span className="font-mono">{hhmm(checkedOutAt)}</span> · Feierabend <span className="font-mono">{hhmm(checkedOutAt)}</span>
{duration && ` · ${duration}`} {presenceSeconds !== null && ` · ${formatDurationCompact(presenceSeconds)} anwesend`}
</span> </span>
<Button
size="sm"
variant="ghost"
className="ml-auto"
disabled={reopen.isPending}
onClick={() => reopen.mutate()}
>
<Play size={14} /> Arbeit fortsetzen
</Button>
</>
) : ( ) : (
<>
{presenceSeconds !== null && (
<span className="text-[var(--color-ink-muted)]">
· anwesend seit{' '}
<span className="font-mono">{formatDurationCompact(presenceSeconds)}</span>
</span>
)}
<Button <Button
size="sm" size="sm"
variant="secondary" variant="secondary"
className="ml-auto" className="ml-auto"
disabled={checkOut.isPending} onClick={() => setConfirmOpen(true)}
onClick={() => checkOut.mutate()}
> >
<LogOut size={14} /> Feierabend / Check-Out <LogOut size={14} /> Feierabend / Check-Out
</Button> </Button>
</>
)} )}
</div> </div>
<FeierabendDialog
open={confirmOpen}
onClose={() => setConfirmOpen(false)}
todos={todos}
reflected={reflected}
pending={checkOut.isPending}
onConfirm={() => checkOut.mutate()}
/>
</>
);
}
/**
* Tagesabschluss vor dem Feierabend: kurze Zusammenfassung (erledigt/offen/
* verworfen) und ein Hinweis, falls noch ToDos offen oder die Reflexion fehlt.
* Feierabend ist reversibel ("Arbeit fortsetzen") — der Dialog ist daher Info,
* keine harte Sperre.
*/
function FeierabendDialog({
open,
onClose,
todos,
reflected,
pending,
onConfirm,
}: {
open: boolean;
onClose: () => void;
todos: Array<{ id: string; title: string; status: 'open' | 'done' | 'dropped' }>;
reflected: boolean;
pending: boolean;
onConfirm: () => void;
}) {
const navigate = useNavigate();
const done = todos.filter((t) => t.status === 'done');
const dropped = todos.filter((t) => t.status === 'dropped');
const offen = todos.filter((t) => t.status === 'open');
const reflexionEmpfohlen = !reflected || offen.length > 0;
return (
<Modal open={open} onClose={onClose} title="Feierabend?" size="md">
<p className="mt-1 text-sm text-[var(--color-ink-muted)]">
Kurzer Blick auf den Tag, bevor du abschließt.
</p>
<div className="mt-4 flex flex-wrap gap-x-4 gap-y-1 text-sm">
<span>
<strong>{done.length}</strong> erledigt
</span>
<span>
<strong>{offen.length}</strong> offen
</span>
{dropped.length > 0 && (
<span>
<strong>{dropped.length}</strong> verworfen
</span>
)}
</div>
{done.length > 0 && (
<ul className="mt-3 space-y-1 text-sm">
{done.map((t) => (
<li key={t.id} className="flex items-center gap-2 text-[var(--color-ink-muted)]">
<Check size={14} className="shrink-0 text-[var(--color-ampel-green-fg)]" />
<span className="truncate">{t.title}</span>
</li>
))}
</ul>
)}
{offen.length > 0 && (
<div className="mt-4 rounded-[var(--radius-md)] border border-[var(--color-ampel-amber-fg)] bg-[var(--color-ampel-amber-bg)] px-3 py-2 text-sm">
<strong className="block">Noch offen — nicht reflektiert:</strong>
<ul className="mt-1 space-y-0.5">
{offen.map((t) => (
<li key={t.id} className="truncate">
· {t.title}
</li>
))}
</ul>
</div>
)}
{!reflected && (
<p className="mt-3 text-sm text-[var(--color-ink-muted)]">
Du hast heute noch nicht reflektiert.
</p>
)}
<div className="mt-5 flex flex-wrap justify-end gap-2">
<Button variant="ghost" onClick={onClose}>
Abbrechen
</Button>
{reflexionEmpfohlen && (
<Button variant="secondary" onClick={() => navigate('/reflexion')}>
Zur Reflexion
</Button>
)}
<Button variant="primary" disabled={pending} onClick={onConfirm}>
Tag abschließen
</Button>
</div>
</Modal>
); );
} }
@@ -413,11 +552,17 @@ function EinstempeltView({
todos, todos,
entry, entry,
}: { }: {
todos: Array<{ id: string; title: string; status: 'open' | 'done' | 'dropped'; unplanned?: boolean }>; todos: Array<{
id: string;
title: string;
status: 'open' | 'done' | 'dropped';
unplanned?: boolean;
}>;
entry: { entry: {
status: 'begun' | 'full' | 'absent'; status: 'begun' | 'full' | 'absent';
checkedInAt: string | Date | null; checkedInAt: string | Date | null;
checkedOutAt: string | Date | null; checkedOutAt: string | Date | null;
autoCheckedIn: boolean;
}; };
}) { }) {
// Reflexion ist „fällig", wenn nach 18:00 Berlin und noch nicht abgeschlossen. // Reflexion ist „fällig", wenn nach 18:00 Berlin und noch nicht abgeschlossen.
@@ -436,7 +581,13 @@ function EinstempeltView({
<p className="mt-1 text-[var(--color-ink-muted)]">{subtitle}</p> <p className="mt-1 text-[var(--color-ink-muted)]">{subtitle}</p>
</header> </header>
<CheckInOutBar checkedInAt={entry.checkedInAt} checkedOutAt={entry.checkedOutAt} /> <CheckInOutBar
checkedInAt={entry.checkedInAt}
checkedOutAt={entry.checkedOutAt}
autoCheckedIn={entry.autoCheckedIn}
todos={todos}
reflected={entry.status === 'full'}
/>
{reflectionDue && ( {reflectionDue && (
<div <div
+79 -18
View File
@@ -1,18 +1,31 @@
import { useState } from 'react'; import { useState } from 'react';
import { ChevronLeft, ChevronRight } from 'lucide-react'; import { useNavigate } from 'react-router';
import { ChevronLeft, ChevronRight, Pencil } from 'lucide-react';
import { clsx } from 'clsx'; import { clsx } from 'clsx';
import type { inferRouterOutputs } from '@trpc/server'; import type { inferRouterOutputs } from '@trpc/server';
import type { AppRouter } from '@cockpit/api/router'; import type { AppRouter } from '@cockpit/api/router';
import { trpc } from '../lib/trpc'; import { trpc } from '../lib/trpc';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
import { Button } from '../components/ui/Button';
import { SkeletonCard } from '../components/ui/SkeletonCard'; import { SkeletonCard } from '../components/ui/SkeletonCard';
import { ErrorState } from '../components/ui/ErrorState';
import { useCurrentUser } from '../hooks/useCurrentUser';
type HistoryPerson = inferRouterOutputs<AppRouter>['dayEntry']['historyForDate']['entries'][number]; type HistoryPerson = inferRouterOutputs<AppRouter>['dayEntry']['historyForDate']['entries'][number];
const AMPEL_META: Record<string, { label: string; badge: string }> = { const AMPEL_META: Record<string, { label: string; badge: string }> = {
green: { label: 'Im Plan', badge: 'bg-[var(--color-ampel-green-bg)] text-[var(--color-ampel-green-fg)]' }, green: {
amber: { label: 'Gefährdet', badge: 'bg-[var(--color-ampel-amber-bg)] text-[var(--color-ampel-amber-fg)]' }, label: 'Im Plan',
red: { label: 'Blockiert', badge: 'bg-[var(--color-ampel-red-bg)] text-[var(--color-ampel-red-fg)]' }, badge: 'bg-[var(--color-ampel-green-bg)] text-[var(--color-ampel-green-fg)]',
},
amber: {
label: 'Gefährdet',
badge: 'bg-[var(--color-ampel-amber-bg)] text-[var(--color-ampel-amber-fg)]',
},
red: {
label: 'Blockiert',
badge: 'bg-[var(--color-ampel-red-bg)] text-[var(--color-ampel-red-fg)]',
},
}; };
const TREND_LABEL: Record<string, string> = { const TREND_LABEL: Record<string, string> = {
besser: '↗ Besser', besser: '↗ Besser',
@@ -32,13 +45,30 @@ function formatDateLong(iso: string): string {
const todayStr = new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Berlin' }).format(new Date()); const todayStr = new Intl.DateTimeFormat('en-CA', { timeZone: 'Europe/Berlin' }).format(new Date());
// Editierbar bis 3 Kalendertage nach dem Tag (Spiegel der Backend-Nachfrist).
function isWithinGraceFE(dateIso: string): boolean {
const cur = new Date(`${dateIso}T12:00:00Z`).getTime();
const today = new Date(`${todayStr}T12:00:00Z`).getTime();
const diffDays = Math.round((today - cur) / 86_400_000);
return diffDays >= 0 && diffDays <= 3;
}
export function HistorieRoute() { export function HistorieRoute() {
const [date, setDate] = useState<string | undefined>(undefined); const [date, setDate] = useState<string | undefined>(undefined);
const me = useCurrentUser();
const navigate = useNavigate();
const q = trpc.dayEntry.historyForDate.useQuery({ date }); const q = trpc.dayEntry.historyForDate.useQuery({ date });
if (q.isPending) return <SkeletonCard lines={6} />; if (q.isPending) return <SkeletonCard lines={6} />;
if (!q.data) return null; if (q.isError || !q.data)
return (
<ErrorState
message="Historie konnte nicht geladen werden."
onRetry={() => void q.refetch()}
/>
);
const { date: current, prevDate, nextDate, entries, ohneEintrag } = q.data; const { date: current, prevDate, nextDate, entries, ohneEintrag } = q.data;
const editableDay = isWithinGraceFE(current);
return ( return (
<div className="space-y-6"> <div className="space-y-6">
@@ -52,9 +82,10 @@ export function HistorieRoute() {
<div className="flex flex-wrap items-center gap-2"> <div className="flex flex-wrap items-center gap-2">
<button <button
type="button" type="button"
onClick={() => setDate(prevDate)} onClick={() => prevDate && setDate(prevDate)}
aria-label="Vorheriger Werktag" disabled={!prevDate}
className="inline-flex h-9 w-9 items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-ink-muted)] hover:border-[var(--color-ink)] hover:text-[var(--color-ink)]" aria-label="Vorheriger Tag mit Eintrag"
className="inline-flex h-9 w-9 items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-ink-muted)] hover:border-[var(--color-ink)] hover:text-[var(--color-ink)] disabled:opacity-40 disabled:hover:border-[var(--color-border)]"
> >
<ChevronLeft size={16} /> <ChevronLeft size={16} />
</button> </button>
@@ -63,7 +94,7 @@ export function HistorieRoute() {
type="button" type="button"
onClick={() => nextDate && setDate(nextDate)} onClick={() => nextDate && setDate(nextDate)}
disabled={!nextDate} disabled={!nextDate}
aria-label="Nächster Werktag" aria-label="Nächster Tag mit Eintrag"
className="inline-flex h-9 w-9 items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-ink-muted)] hover:border-[var(--color-ink)] hover:text-[var(--color-ink)] disabled:opacity-40 disabled:hover:border-[var(--color-border)]" className="inline-flex h-9 w-9 items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-ink-muted)] hover:border-[var(--color-ink)] hover:text-[var(--color-ink)] disabled:opacity-40 disabled:hover:border-[var(--color-border)]"
> >
<ChevronRight size={16} /> <ChevronRight size={16} />
@@ -80,15 +111,18 @@ export function HistorieRoute() {
{entries.length === 0 ? ( {entries.length === 0 ? (
<Card.Root> <Card.Root>
<Card.Body> <Card.Body>
<p className="text-sm text-[var(--color-ink-muted)]"> <p className="text-sm text-[var(--color-ink-muted)]">Keine Einträge an diesem Tag.</p>
Keine Einträge an diesem Tag.
</p>
</Card.Body> </Card.Body>
</Card.Root> </Card.Root>
) : ( ) : (
<div className="space-y-3"> <div className="space-y-3">
{entries.map((p) => ( {entries.map((p) => (
<PersonCard key={p.userId} person={p} /> <PersonCard
key={p.userId}
person={p}
canEdit={p.userId === me?.id && editableDay}
onEdit={() => navigate(`/reflexion?date=${current}`)}
/>
))} ))}
</div> </div>
)} )}
@@ -102,7 +136,15 @@ export function HistorieRoute() {
); );
} }
function PersonCard({ person: p }: { person: HistoryPerson }) { function PersonCard({
person: p,
canEdit,
onEdit,
}: {
person: HistoryPerson;
canEdit: boolean;
onEdit: () => void;
}) {
const ampel = p.ampel ? AMPEL_META[p.ampel] : null; const ampel = p.ampel ? AMPEL_META[p.ampel] : null;
return ( return (
<Card.Root> <Card.Root>
@@ -124,6 +166,11 @@ function PersonCard({ person: p }: { person: HistoryPerson }) {
nicht reflektiert nicht reflektiert
</span> </span>
)} )}
{canEdit && (
<Button size="sm" variant="ghost" className="ml-auto" onClick={onEdit}>
<Pencil size={13} /> Bearbeiten
</Button>
)}
</div> </div>
{p.todos.length > 0 && ( {p.todos.length > 0 && (
@@ -140,6 +187,7 @@ function PersonCard({ person: p }: { person: HistoryPerson }) {
: 'bg-[var(--color-border-strong)]', : 'bg-[var(--color-border-strong)]',
)} )}
/> />
<div className="flex-1">
<span <span
className={clsx( className={clsx(
t.status === 'dropped' && 'text-[var(--color-ink-muted)] line-through', t.status === 'dropped' && 'text-[var(--color-ink-muted)] line-through',
@@ -151,10 +199,13 @@ function PersonCard({ person: p }: { person: HistoryPerson }) {
ungeplant ungeplant
</span> </span>
)} )}
{t.status === 'dropped' && t.dropReason && (
<span className="text-xs text-[var(--color-ink-faint)]"> — {t.dropReason}</span>
)}
</span> </span>
{t.dropReason && (
<span className="mt-0.5 block whitespace-pre-wrap text-xs text-[var(--color-ink-muted)]">
{t.dropReason}
</span>
)}
</div>
</li> </li>
))} ))}
</ul> </ul>
@@ -163,7 +214,17 @@ function PersonCard({ person: p }: { person: HistoryPerson }) {
{p.reflectionText && ( {p.reflectionText && (
<p className="whitespace-pre-wrap text-sm text-[var(--color-ink)]">{p.reflectionText}</p> <p className="whitespace-pre-wrap text-sm text-[var(--color-ink)]">{p.reflectionText}</p>
)} )}
{p.todos.length === 0 && !p.reflectionText && ( {p.url && (
<a
href={p.url}
target="_blank"
rel="noopener noreferrer"
className="block truncate text-sm text-[var(--color-ink-muted)] underline hover:text-[var(--color-ink)]"
>
{p.url}
</a>
)}
{p.todos.length === 0 && !p.reflectionText && !p.url && (
<p className="text-xs text-[var(--color-ink-faint)]">Keine Details.</p> <p className="text-xs text-[var(--color-ink-faint)]">Keine Details.</p>
)} )}
</Card.Body> </Card.Body>
+145 -39
View File
@@ -10,6 +10,9 @@ import { voice } from '../lib/voice';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
import { Button } from '../components/ui/Button'; import { Button } from '../components/ui/Button';
import { SkeletonCard } from '../components/ui/SkeletonCard'; import { SkeletonCard } from '../components/ui/SkeletonCard';
import { ErrorState } from '../components/ui/ErrorState';
import { Modal } from '../components/ui/Modal';
import { useConfirm } from '../components/ui/ConfirmProvider';
import { import {
LEAD_STATUS_META, LEAD_STATUS_META,
LEAD_STATUS_ORDER, LEAD_STATUS_ORDER,
@@ -71,7 +74,10 @@ export function LeadRoute() {
const q = trpc.lead.byId.useQuery({ id }); const q = trpc.lead.byId.useQuery({ id });
if (q.isPending) return <SkeletonCard lines={8} />; if (q.isPending) return <SkeletonCard lines={8} />;
if (!q.data) return null; if (q.isError || !q.data)
return (
<ErrorState message="Lead konnte nicht geladen werden." onRetry={() => void q.refetch()} />
);
const { lead, contacts, touchpoints } = q.data; const { lead, contacts, touchpoints } = q.data;
function goBack() { function goBack() {
@@ -297,9 +303,7 @@ function Header({ lead, onBack }: { lead: LeadDossier; onBack: () => void }) {
<span className="text-[var(--color-ink-muted)]">Owner</span> <span className="text-[var(--color-ink-muted)]">Owner</span>
<select <select
value={lead.ownerUserId ?? ''} value={lead.ownerUserId ?? ''}
onChange={(e) => onChange={(e) => update.mutate({ id: lead.id, ownerUserId: e.target.value || null })}
update.mutate({ id: lead.id, ownerUserId: e.target.value || null })
}
className="rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white px-2 py-1 text-sm" className="rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white px-2 py-1 text-sm"
> >
<option value="">— niemand —</option> <option value="">— niemand —</option>
@@ -354,12 +358,7 @@ function PromoteDialog({ leadId, onClose }: { leadId: string; onClose: () => voi
}, },
}); });
return ( return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/30" onClick={onClose}> <Modal open onClose={onClose} title="Zu Deal machen" size="sm">
<div
className="w-full max-w-sm rounded-[var(--radius-xl)] bg-[var(--color-bg)] p-6 shadow-[var(--shadow-lg)]"
onClick={(e) => e.stopPropagation()}
>
<h2 className="text-xl font-semibold">Zu Deal machen</h2>
<p className="mt-1 text-sm text-[var(--color-ink-muted)]"> <p className="mt-1 text-sm text-[var(--color-ink-muted)]">
Legt einen Pipeline-Deal in Stufe „Lead“ an und verknüpft ihn. Legt einen Pipeline-Deal in Stufe „Lead“ an und verknüpft ihn.
</p> </p>
@@ -400,8 +399,7 @@ function PromoteDialog({ leadId, onClose }: { leadId: string; onClose: () => voi
</Button> </Button>
</div> </div>
</form> </form>
</div> </Modal>
</div>
); );
} }
@@ -522,13 +520,7 @@ function EditableSection({
); );
} }
function VertrauenslevelControl({ function VertrauenslevelControl({ leadId, value }: { leadId: string; value: number | null }) {
leadId,
value,
}: {
leadId: string;
value: number | null;
}) {
const utils = trpc.useUtils(); const utils = trpc.useUtils();
const update = trpc.lead.update.useMutation({ const update = trpc.lead.update.useMutation({
onSuccess: async () => { onSuccess: async () => {
@@ -541,7 +533,10 @@ function VertrauenslevelControl({
<select <select
value={value ?? ''} value={value ?? ''}
onChange={(e) => onChange={(e) =>
update.mutate({ id: leadId, vertrauenslevel: e.target.value ? Number(e.target.value) : null }) update.mutate({
id: leadId,
vertrauenslevel: e.target.value ? Number(e.target.value) : null,
})
} }
className="rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white px-2 py-1 text-sm" className="rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white px-2 py-1 text-sm"
> >
@@ -593,6 +588,7 @@ function ContactRow({ leadId, contact }: { leadId: string; contact: Contact }) {
await utils.lead.byId.invalidate({ id: leadId }); await utils.lead.byId.invalidate({ id: leadId });
}, },
}); });
const confirm = useConfirm();
const details = [ const details = [
contact.email, contact.email,
contact.telefon, contact.telefon,
@@ -630,7 +626,16 @@ function ContactRow({ leadId, contact }: { leadId: string; contact: Contact }) {
</div> </div>
<button <button
type="button" type="button"
onClick={() => remove.mutate({ contactId: contact.id })} onClick={async () => {
if (
await confirm({
title: 'Kontakt entfernen?',
destructive: true,
confirmLabel: 'Entfernen',
})
)
remove.mutate({ contactId: contact.id });
}}
aria-label="Kontakt entfernen" aria-label="Kontakt entfernen"
className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]" className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]"
> >
@@ -687,8 +692,18 @@ function AddContactForm({ leadId, onDone }: { leadId: string; onDone: () => void
}} }}
> >
<div className="grid grid-cols-2 gap-2"> <div className="grid grid-cols-2 gap-2">
<input placeholder="Name *" value={name} onChange={(e) => setName(e.target.value)} className={inputCls} /> <input
<input placeholder="Rolle / Titel" value={rolle} onChange={(e) => setRolle(e.target.value)} className={inputCls} /> placeholder="Name *"
value={name}
onChange={(e) => setName(e.target.value)}
className={inputCls}
/>
<input
placeholder="Rolle / Titel"
value={rolle}
onChange={(e) => setRolle(e.target.value)}
className={inputCls}
/>
<select value={funktion} onChange={(e) => setFunktion(e.target.value)} className={inputCls}> <select value={funktion} onChange={(e) => setFunktion(e.target.value)} className={inputCls}>
<option value="">Funktion im Kaufprozess</option> <option value="">Funktion im Kaufprozess</option>
{Object.entries(CONTACT_FUNKTION_LABEL).map(([v, l]) => ( {Object.entries(CONTACT_FUNKTION_LABEL).map(([v, l]) => (
@@ -697,14 +712,43 @@ function AddContactForm({ leadId, onDone }: { leadId: string; onDone: () => void
</option> </option>
))} ))}
</select> </select>
<input placeholder="E-Mail" value={email} onChange={(e) => setEmail(e.target.value)} className={inputCls} /> <input
<input placeholder="Telefon" value={telefon} onChange={(e) => setTelefon(e.target.value)} className={inputCls} /> placeholder="E-Mail"
<input placeholder="LinkedIn-URL" value={linkedin} onChange={(e) => setLinkedin(e.target.value)} className={inputCls} /> value={email}
<input placeholder="Sprache / Anrede" value={sprache} onChange={(e) => setSprache(e.target.value)} className={inputCls} /> onChange={(e) => setEmail(e.target.value)}
<input placeholder="Im Buying-Center seit" value={seit} onChange={(e) => setSeit(e.target.value)} className={inputCls} /> className={inputCls}
/>
<input
placeholder="Telefon"
value={telefon}
onChange={(e) => setTelefon(e.target.value)}
className={inputCls}
/>
<input
placeholder="LinkedIn-URL"
value={linkedin}
onChange={(e) => setLinkedin(e.target.value)}
className={inputCls}
/>
<input
placeholder="Sprache / Anrede"
value={sprache}
onChange={(e) => setSprache(e.target.value)}
className={inputCls}
/>
<input
placeholder="Im Buying-Center seit"
value={seit}
onChange={(e) => setSeit(e.target.value)}
className={inputCls}
/>
</div> </div>
<label className="flex items-center gap-2 text-sm"> <label className="flex items-center gap-2 text-sm">
<input type="checkbox" checked={isPrimary} onChange={(e) => setIsPrimary(e.target.checked)} /> <input
type="checkbox"
checked={isPrimary}
onChange={(e) => setIsPrimary(e.target.checked)}
/>
Hauptkontakt Hauptkontakt
</label> </label>
<div className="flex justify-end gap-2"> <div className="flex justify-end gap-2">
@@ -767,6 +811,7 @@ function TouchpointRow({ leadId, touchpoint }: { leadId: string; touchpoint: Tou
await utils.lead.byId.invalidate({ id: leadId }); await utils.lead.byId.invalidate({ id: leadId });
}, },
}); });
const confirm = useConfirm();
return ( return (
<div className="rounded-[var(--radius-md)] border border-[var(--color-border)] p-3 text-sm"> <div className="rounded-[var(--radius-md)] border border-[var(--color-border)] p-3 text-sm">
<div className="flex items-start justify-between gap-2"> <div className="flex items-start justify-between gap-2">
@@ -784,7 +829,16 @@ function TouchpointRow({ leadId, touchpoint }: { leadId: string; touchpoint: Tou
</div> </div>
<button <button
type="button" type="button"
onClick={() => remove.mutate({ touchpointId: touchpoint.id })} onClick={async () => {
if (
await confirm({
title: 'Touchpoint löschen?',
destructive: true,
confirmLabel: 'Löschen',
})
)
remove.mutate({ touchpointId: touchpoint.id });
}}
aria-label="Eintrag entfernen" aria-label="Eintrag entfernen"
className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]" className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]"
> >
@@ -832,7 +886,12 @@ function AddTouchpointForm({ leadId, onDone }: { leadId: string; onDone: () => v
}} }}
> >
<div className="grid grid-cols-2 gap-2"> <div className="grid grid-cols-2 gap-2">
<input type="date" value={datum} onChange={(e) => setDatum(e.target.value)} className={inputCls} /> <input
type="date"
value={datum}
onChange={(e) => setDatum(e.target.value)}
className={inputCls}
/>
<select value={kanal} onChange={(e) => setKanal(e.target.value)} className={inputCls}> <select value={kanal} onChange={(e) => setKanal(e.target.value)} className={inputCls}>
{Object.entries(TOUCHPOINT_KANAL_LABEL).map(([v, l]) => ( {Object.entries(TOUCHPOINT_KANAL_LABEL).map(([v, l]) => (
<option key={v} value={v}> <option key={v} value={v}>
@@ -849,10 +908,20 @@ function AddTouchpointForm({ leadId, onDone }: { leadId: string; onDone: () => v
className={inputCls} className={inputCls}
/> />
<div className="grid grid-cols-2 gap-2"> <div className="grid grid-cols-2 gap-2">
<input placeholder="Outcome" value={outcome} onChange={(e) => setOutcome(e.target.value)} className={inputCls} /> <input
placeholder="Outcome"
value={outcome}
onChange={(e) => setOutcome(e.target.value)}
className={inputCls}
/>
<label className="flex flex-col text-xs text-[var(--color-ink-muted)]"> <label className="flex flex-col text-xs text-[var(--color-ink-muted)]">
Follow-up bis Follow-up bis
<input type="date" value={followUp} onChange={(e) => setFollowUp(e.target.value)} className={inputCls} /> <input
type="date"
value={followUp}
onChange={(e) => setFollowUp(e.target.value)}
className={inputCls}
/>
</label> </label>
</div> </div>
<div className="flex justify-end gap-2"> <div className="flex justify-end gap-2">
@@ -882,6 +951,7 @@ function OffeneFragenSection({
await utils.lead.byId.invalidate({ id: leadId }); await utils.lead.byId.invalidate({ id: leadId });
}, },
}); });
const confirm = useConfirm();
function persist(next: Array<{ text: string; done: boolean }>) { function persist(next: Array<{ text: string; done: boolean }>) {
update.mutate({ id: leadId, offeneFragen: next }); update.mutate({ id: leadId, offeneFragen: next });
} }
@@ -904,12 +974,23 @@ function OffeneFragenSection({
persist(fragen.map((x, j) => (j === i ? { ...x, done: !x.done } : x))) persist(fragen.map((x, j) => (j === i ? { ...x, done: !x.done } : x)))
} }
/> />
<span className={clsx('flex-1', f.done && 'text-[var(--color-ink-muted)] line-through')}> <span
className={clsx('flex-1', f.done && 'text-[var(--color-ink-muted)] line-through')}
>
{f.text} {f.text}
</span> </span>
<button <button
type="button" type="button"
onClick={() => persist(fragen.filter((_, j) => j !== i))} onClick={async () => {
if (
await confirm({
title: 'Frage löschen?',
destructive: true,
confirmLabel: 'Löschen',
})
)
persist(fragen.filter((_, j) => j !== i));
}}
aria-label="Frage entfernen" aria-label="Frage entfernen"
className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]" className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]"
> >
@@ -959,6 +1040,7 @@ function AnhaengeSection({
await utils.lead.byId.invalidate({ id: leadId }); await utils.lead.byId.invalidate({ id: leadId });
}, },
}); });
const confirm = useConfirm();
function persist(next: Array<{ label: string; url: string }>) { function persist(next: Array<{ label: string; url: string }>) {
update.mutate({ id: leadId, anhaenge: next }); update.mutate({ id: leadId, anhaenge: next });
} }
@@ -977,7 +1059,16 @@ function AnhaengeSection({
<ExternalLink url={a.url} label={a.label} /> <ExternalLink url={a.url} label={a.label} />
<button <button
type="button" type="button"
onClick={() => persist(anhaenge.filter((_, j) => j !== i))} onClick={async () => {
if (
await confirm({
title: 'Anhang entfernen?',
destructive: true,
confirmLabel: 'Entfernen',
})
)
persist(anhaenge.filter((_, j) => j !== i));
}}
aria-label="Anhang entfernen" aria-label="Anhang entfernen"
className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]" className="text-[var(--color-ink-faint)] hover:text-[var(--color-ampel-red-fg)]"
> >
@@ -996,8 +1087,18 @@ function AnhaengeSection({
setUrl(''); setUrl('');
}} }}
> >
<input placeholder="Bezeichnung" value={label} onChange={(e) => setLabel(e.target.value)} className={inputCls} /> <input
<input placeholder="URL" value={url} onChange={(e) => setUrl(e.target.value)} className={inputCls} /> placeholder="Bezeichnung"
value={label}
onChange={(e) => setLabel(e.target.value)}
className={inputCls}
/>
<input
placeholder="URL"
value={url}
onChange={(e) => setUrl(e.target.value)}
className={inputCls}
/>
<Button type="submit" size="sm" variant="secondary"> <Button type="submit" size="sm" variant="secondary">
<Plus size={14} /> <Plus size={14} />
</Button> </Button>
@@ -1010,7 +1111,12 @@ function AnhaengeSection({
function ExternalLink({ url, label }: { url: string; label?: string }) { function ExternalLink({ url, label }: { url: string; label?: string }) {
const href = url.startsWith('http') ? url : `https://${url}`; const href = url.startsWith('http') ? url : `https://${url}`;
return ( return (
<a href={href} target="_blank" rel="noreferrer" className="truncate text-[var(--color-ink)] hover:underline"> <a
href={href}
target="_blank"
rel="noreferrer"
className="truncate text-[var(--color-ink)] hover:underline"
>
{label ?? url} {label ?? url}
</a> </a>
); );
+68 -32
View File
@@ -1,17 +1,15 @@
import { useState } from 'react'; import { useState } from 'react';
import { Link } from 'react-router'; import { Link } from 'react-router';
import { BellRing } from 'lucide-react';
import { clsx } from 'clsx'; import { clsx } from 'clsx';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { trpc } from '../lib/trpc'; import { trpc } from '../lib/trpc';
import { voice } from '../lib/voice'; import { voice } from '../lib/voice';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
import { Button } from '../components/ui/Button'; import { Button } from '../components/ui/Button';
import { Modal } from '../components/ui/Modal';
import { SkeletonCard } from '../components/ui/SkeletonCard'; import { SkeletonCard } from '../components/ui/SkeletonCard';
import { import { LEAD_STATUS_META, LEAD_STATUS_ORDER, type LeadStatus } from '../lib/lead-meta';
LEAD_STATUS_META,
LEAD_STATUS_ORDER,
type LeadStatus,
} from '../lib/lead-meta';
export function LeadsRoute() { export function LeadsRoute() {
const q = trpc.lead.list.useQuery(); const q = trpc.lead.list.useQuery();
@@ -37,6 +35,12 @@ export function LeadsRoute() {
</p> </p>
</div> </div>
<div className="flex gap-2"> <div className="flex gap-2">
<Link
to="/pipeline"
className="inline-flex h-9 items-center rounded-md px-4 text-sm font-medium text-[var(--color-ink)] transition-colors hover:bg-black/5"
>
Pipeline
</Link>
<Button variant="secondary" onClick={() => setImportOpen(true)}> <Button variant="secondary" onClick={() => setImportOpen(true)}>
CSV importieren CSV importieren
</Button> </Button>
@@ -44,12 +48,12 @@ export function LeadsRoute() {
</div> </div>
</header> </header>
<DueFollowUps />
{leads.length === 0 ? ( {leads.length === 0 ? (
<Card.Root> <Card.Root>
<Card.Body> <Card.Body>
<p className="text-sm text-[var(--color-ink-muted)]"> <p className="text-sm text-[var(--color-ink-muted)]">Noch keine Leads. Leg einen an.</p>
Noch keine Leads. Leg einen an.
</p>
</Card.Body> </Card.Body>
</Card.Root> </Card.Root>
) : ( ) : (
@@ -80,6 +84,36 @@ export function LeadsRoute() {
); );
} }
function DueFollowUps() {
const q = trpc.lead.dueFollowUps.useQuery();
if (!q.data || q.data.length === 0) return null;
return (
<Card.Root>
<Card.Body>
<h2 className="mb-2 flex items-center gap-2 text-lg font-semibold">
<BellRing size={16} className="text-[var(--color-ampel-amber-fg)]" />
Fällige Wiedervorlagen ({q.data.length})
</h2>
<ul className="space-y-1.5 text-sm">
{q.data.map((l) => (
<li key={l.id} className="flex items-center justify-between gap-3">
<Link to={`/lead/${l.id}`} className="min-w-0 flex-1 truncate hover:underline">
<span className="font-medium">{l.firma}</span>
{l.naechsterSchritt && (
<span className="text-[var(--color-ink-muted)]"> — {l.naechsterSchritt}</span>
)}
</Link>
<span className="shrink-0 font-mono text-xs text-[var(--color-ampel-amber-fg)]">
{l.faelligAm}
</span>
</li>
))}
</ul>
</Card.Body>
</Card.Root>
);
}
function LeadImportDialog({ onClose }: { onClose: () => void }) { function LeadImportDialog({ onClose }: { onClose: () => void }) {
const projectsQ = trpc.project.list.useQuery(); const projectsQ = trpc.project.list.useQuery();
const projects = (projectsQ.data ?? []).map((r) => ({ id: r.project.id, name: r.project.name })); const projects = (projectsQ.data ?? []).map((r) => ({ id: r.project.id, name: r.project.name }));
@@ -113,17 +147,12 @@ function LeadImportDialog({ onClose }: { onClose: () => void }) {
} }
return ( return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/30" onClick={onClose}> <Modal open onClose={onClose} title="Leads aus CSV importieren">
<div
className="w-full max-w-md rounded-[var(--radius-xl)] bg-[var(--color-bg)] p-6 shadow-[var(--shadow-lg)]"
onClick={(e) => e.stopPropagation()}
>
<h2 className="text-xl font-semibold">Leads aus CSV importieren</h2>
<p className="mt-1 text-sm text-[var(--color-ink-muted)]"> <p className="mt-1 text-sm text-[var(--color-ink-muted)]">
Spalten: Quelle, Vorname, Nachname, Position, Firma, Straße, PLZ, Ort, Telefon, Mobil, Spalten: Quelle, Vorname, Nachname, Position, Firma, Straße, PLZ, Ort, Telefon, Mobil, Fax,
Fax, E-Mail, Website, Branche, Notizen. Je Zeile entsteht ein Lead mit primärem Kontakt; E-Mail, Website, Branche, Notizen. Je Zeile entsteht ein Lead mit primärem Kontakt; Notizen
Notizen werden als erster Austausch-Log-Eintrag gespeichert. Duplikate (gleicher werden als erster Austausch-Log-Eintrag gespeichert. Duplikate (gleicher Firmenname) werden
Firmenname) werden übersprungen. übersprungen.
</p> </p>
<div className="mt-4 space-y-3"> <div className="mt-4 space-y-3">
@@ -167,7 +196,9 @@ function LeadImportDialog({ onClose }: { onClose: () => void }) {
<ul className="mt-1 space-y-0.5 text-xs text-[var(--color-ink-muted)]"> <ul className="mt-1 space-y-0.5 text-xs text-[var(--color-ink-muted)]">
<li>{result.contacts} Kontakte angelegt</li> <li>{result.contacts} Kontakte angelegt</li>
<li>{result.touchpoints} Notizen als Log-Eintrag</li> <li>{result.touchpoints} Notizen als Log-Eintrag</li>
{result.skippedDuplicate > 0 && <li>{result.skippedDuplicate} Duplikate übersprungen</li>} {result.skippedDuplicate > 0 && (
<li>{result.skippedDuplicate} Duplikate übersprungen</li>
)}
{result.skippedEmpty > 0 && <li>{result.skippedEmpty} leere Zeilen übersprungen</li>} {result.skippedEmpty > 0 && <li>{result.skippedEmpty} leere Zeilen übersprungen</li>}
</ul> </ul>
</div> </div>
@@ -188,8 +219,7 @@ function LeadImportDialog({ onClose }: { onClose: () => void }) {
)} )}
</div> </div>
</div> </div>
</div> </Modal>
</div>
); );
} }
@@ -281,12 +311,7 @@ function LeadCreateDialog({ onClose }: { onClose: () => void }) {
} }
return ( return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/30" onClick={onClose}> <Modal open onClose={onClose} title="Neuer Lead">
<div
className="max-h-[90vh] w-full max-w-md overflow-y-auto rounded-[var(--radius-xl)] bg-[var(--color-bg)] p-6 shadow-[var(--shadow-lg)]"
onClick={(e) => e.stopPropagation()}
>
<h2 className="text-xl font-semibold">Neuer Lead</h2>
<p className="mt-1 text-sm text-[var(--color-ink-muted)]"> <p className="mt-1 text-sm text-[var(--color-ink-muted)]">
Nur die Firma ist Pflicht — alles Weitere füllst du im Dossier. Nur die Firma ist Pflicht — alles Weitere füllst du im Dossier.
</p> </p>
@@ -301,7 +326,11 @@ function LeadCreateDialog({ onClose }: { onClose: () => void }) {
</Field> </Field>
<div className="grid grid-cols-2 gap-3"> <div className="grid grid-cols-2 gap-3">
<Field label="Branche"> <Field label="Branche">
<input value={branche} onChange={(e) => setBranche(e.target.value)} className={inputCls} /> <input
value={branche}
onChange={(e) => setBranche(e.target.value)}
className={inputCls}
/>
</Field> </Field>
<Field label="Nische / Sub-Segment"> <Field label="Nische / Sub-Segment">
<input <input
@@ -312,13 +341,21 @@ function LeadCreateDialog({ onClose }: { onClose: () => void }) {
</Field> </Field>
</div> </div>
<Field label="Website"> <Field label="Website">
<input value={website} onChange={(e) => setWebsite(e.target.value)} className={inputCls} /> <input
value={website}
onChange={(e) => setWebsite(e.target.value)}
className={inputCls}
/>
</Field> </Field>
<Field label="Quelle (wie gefunden)"> <Field label="Quelle (wie gefunden)">
<input value={quelle} onChange={(e) => setQuelle(e.target.value)} className={inputCls} /> <input value={quelle} onChange={(e) => setQuelle(e.target.value)} className={inputCls} />
</Field> </Field>
<Field label="Projekt (optional)"> <Field label="Projekt (optional)">
<select value={projectId} onChange={(e) => setProjectId(e.target.value)} className={inputCls}> <select
value={projectId}
onChange={(e) => setProjectId(e.target.value)}
className={inputCls}
>
<option value="">— kein Projekt —</option> <option value="">— kein Projekt —</option>
{projects.map((p) => ( {projects.map((p) => (
<option key={p.id} value={p.id}> <option key={p.id} value={p.id}>
@@ -375,8 +412,7 @@ function LeadCreateDialog({ onClose }: { onClose: () => void }) {
</Button> </Button>
</div> </div>
</form> </form>
</div> </Modal>
</div>
); );
} }
+1 -3
View File
@@ -25,9 +25,7 @@ export function LoginRoute() {
<h1 className="inline-flex items-center gap-2 text-4xl font-bold"> <h1 className="inline-flex items-center gap-2 text-4xl font-bold">
everythingbutwork <ToolCtrlLogo size={32} /> everythingbutwork <ToolCtrlLogo size={32} />
</h1> </h1>
<p className="mt-3 text-[var(--color-ink-muted)]"> <p className="mt-3 text-[var(--color-ink-muted)]">Internes ToolCTRL-Projektmanagement.</p>
Internes ToolCTRL-Projektmanagement.
</p>
{error && ( {error && (
<p <p
className="mt-4 rounded-[var(--radius-md)] border border-[var(--color-ampel-red-bg)] bg-[var(--color-ampel-red-bg)] px-4 py-2 text-sm text-[var(--color-ampel-red-fg)]" className="mt-4 rounded-[var(--radius-md)] border border-[var(--color-ampel-red-bg)] bg-[var(--color-ampel-red-bg)] px-4 py-2 text-sm text-[var(--color-ampel-red-fg)]"
+92
View File
@@ -0,0 +1,92 @@
import { trpc } from '../lib/trpc';
import { Card } from '../components/ui/Card';
import { SkeletonCard } from '../components/ui/SkeletonCard';
import { ErrorState } from '../components/ui/ErrorState';
const AMPEL_DOT: Record<string, string> = {
green: 'bg-[var(--color-ampel-green-fg)]',
amber: 'bg-[var(--color-ampel-amber-fg)]',
red: 'bg-[var(--color-ampel-red-fg)]',
};
const TREND_LABEL: Record<string, string> = { besser: '↗', gleich: '→', schlechter: '↘' };
function weekday(iso: string): string {
return new Intl.DateTimeFormat('de-DE', {
timeZone: 'Europe/Berlin',
weekday: 'short',
day: 'numeric',
month: 'short',
}).format(new Date(`${iso}T12:00:00Z`));
}
function hhmm(d: string | Date | null): string {
return d
? new Intl.DateTimeFormat('de-DE', {
timeZone: 'Europe/Berlin',
hour: '2-digit',
minute: '2-digit',
}).format(new Date(d))
: '—';
}
export function MeineWocheRoute() {
const q = trpc.dayEntry.myWeek.useQuery();
if (q.isPending) return <SkeletonCard lines={7} />;
if (q.isError || !q.data)
return (
<ErrorState
message="Wochenübersicht konnte nicht geladen werden."
onRetry={() => void q.refetch()}
/>
);
const days = q.data;
const totalDone = days.reduce((s, d) => s + d.todos.done, 0);
return (
<div className="mx-auto max-w-2xl space-y-6">
<header>
<h1 className="text-3xl font-bold">Meine Woche</h1>
<p className="mt-1 text-[var(--color-ink-muted)]">
Die letzten 7 Tage — {totalDone} ToDos erledigt.
</p>
</header>
{days.length === 0 ? (
<Card.Root>
<Card.Body>
<p className="text-sm text-[var(--color-ink-muted)]">
Noch keine Einträge in den letzten 7 Tagen.
</p>
</Card.Body>
</Card.Root>
) : (
<Card.Root>
<Card.Body className="divide-y divide-[var(--color-border)]">
{days.map((d) => (
<div
key={d.date}
className="flex items-center gap-3 py-2.5 text-sm first:pt-0 last:pb-0"
>
<span className="w-28 shrink-0 font-medium">{weekday(d.date)}</span>
<span
className={`h-2 w-2 shrink-0 rounded-full ${d.ampel ? (AMPEL_DOT[d.ampel] ?? '') : 'bg-[var(--color-border-strong)]'}`}
aria-hidden="true"
/>
<span className="flex-1 truncate text-[var(--color-ink-muted)]">
{hhmm(d.checkedInAt)}
{d.checkedOutAt ? `–${hhmm(d.checkedOutAt)}` : d.checkedInAt ? ' …' : ''}
{d.trend ? ` · ${TREND_LABEL[d.trend] ?? ''}` : ''}
</span>
<span className="shrink-0 text-xs text-[var(--color-ink-muted)]">
{d.todos.done}✓{d.todos.open > 0 ? ` · ${d.todos.open} offen` : ''}
{d.todos.dropped > 0 ? ` · ${d.todos.dropped} verworfen` : ''}
</span>
</div>
))}
</Card.Body>
</Card.Root>
)}
</div>
);
}
+154
View File
@@ -0,0 +1,154 @@
import { Link } from 'react-router';
import type { inferRouterOutputs } from '@trpc/server';
import type { AppRouter } from '@cockpit/api/router';
import { trpc } from '../lib/trpc';
import { Card } from '../components/ui/Card';
import { SkeletonCard } from '../components/ui/SkeletonCard';
import { ErrorState } from '../components/ui/ErrorState';
type Deal = inferRouterOutputs<AppRouter>['deal']['list'][number];
const STAGES = [
{ key: 'lead', label: 'Lead' },
{ key: 'erstgespraech', label: 'Erstgespräch' },
{ key: 'demo', label: 'Demo' },
{ key: 'angebot', label: 'Angebot' },
{ key: 'abschluss', label: 'Abschluss' },
] as const;
type Stage = (typeof STAGES)[number]['key'];
// valueEur wird in Cent gespeichert.
const euro = (cents: number) =>
new Intl.NumberFormat('de-DE', {
style: 'currency',
currency: 'EUR',
maximumFractionDigits: 0,
}).format(cents / 100);
export function PipelineRoute() {
const dealsQ = trpc.deal.list.useQuery();
const kpisQ = trpc.deal.kpis.useQuery();
if (dealsQ.isPending) return <SkeletonCard lines={6} />;
if (dealsQ.isError || !dealsQ.data)
return (
<ErrorState
message="Pipeline konnte nicht geladen werden."
onRetry={() => void dealsQ.refetch()}
/>
);
const deals = dealsQ.data;
const k = kpisQ.data;
return (
<div className="space-y-6">
<header>
<p className="text-sm text-[var(--color-ink-muted)]">
<Link to="/bereich/vertrieb" className="hover:underline">
Vertrieb
</Link>
{' › Pipeline'}
</p>
<h1 className="text-3xl font-bold">Pipeline</h1>
<p className="text-[var(--color-ink-muted)]">
Deals nach Stufe. Stufe ändern verschiebt den Deal; „Abschluss“ zählt als gewonnen.
</p>
</header>
{k && (
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3">
<KpiCard label="Gewichtete Pipeline" value={euro(k.weightedPipelineEur)} />
<KpiCard label="Offene Deals" value={String(k.openDealCount)} />
<KpiCard
label="Gewonnen (Quartal)"
value={`${euro(k.wonValueQuarterEur)} · ${k.wonCountQuarter}`}
/>
</div>
)}
{deals.length === 0 ? (
<Card.Root>
<Card.Body>
<p className="text-sm text-[var(--color-ink-muted)]">
Noch keine Deals. Promote einen Lead über das Lead-Dossier („Zu Deal machen“).
</p>
</Card.Body>
</Card.Root>
) : (
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5">
{STAGES.map((stage) => {
const stageDeals = deals.filter((d) => d.stage === stage.key);
const sum = stageDeals.reduce((acc, d) => acc + d.valueEur, 0);
return (
<div key={stage.key} className="space-y-2">
<div className="flex items-baseline justify-between">
<h2 className="text-sm font-semibold">
{stage.label}{' '}
<span className="font-normal text-[var(--color-ink-muted)]">
({stageDeals.length})
</span>
</h2>
{sum > 0 && (
<span className="text-xs text-[var(--color-ink-muted)]">{euro(sum)}</span>
)}
</div>
<div className="space-y-2">
{stageDeals.map((d) => (
<DealCard key={d.id} deal={d} />
))}
</div>
</div>
);
})}
</div>
)}
</div>
);
}
function KpiCard({ label, value }: { label: string; value: string }) {
return (
<Card.Root>
<Card.Body>
<p className="text-xs text-[var(--color-ink-muted)]">{label}</p>
<p className="mt-0.5 text-lg font-semibold">{value}</p>
</Card.Body>
</Card.Root>
);
}
function DealCard({ deal }: { deal: Deal }) {
const utils = trpc.useUtils();
const move = trpc.deal.updateStage.useMutation({
onSuccess: async () => {
await utils.deal.list.invalidate();
await utils.deal.kpis.invalidate();
},
});
return (
<div className="rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white p-2.5 text-sm">
<p className="font-medium">{deal.name}</p>
<p className="mt-0.5 text-xs text-[var(--color-ink-muted)]">
{euro(deal.valueEur)} · {deal.probability}%{deal.wonAt ? ' · gewonnen' : ''}
</p>
<label className="sr-only" htmlFor={`stage-${deal.id}`}>
Stufe von {deal.name}
</label>
<select
id={`stage-${deal.id}`}
value={deal.stage}
onChange={(e) => move.mutate({ dealId: deal.id, stage: e.target.value as Stage })}
disabled={move.isPending}
className="mt-1.5 w-full rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-white px-1.5 py-1 text-xs"
>
{STAGES.map((s) => (
<option key={s.key} value={s.key}>
{s.label}
</option>
))}
</select>
</div>
);
}
File diff suppressed because it is too large. Load diff
+72 -18
View File
@@ -1,5 +1,5 @@
import { useState } from 'react'; import { useState } from 'react';
import { useNavigate } from 'react-router'; import { useNavigate, useSearchParams } from 'react-router';
import { trpc } from '../lib/trpc'; import { trpc } from '../lib/trpc';
import { voice } from '../lib/voice'; import { voice } from '../lib/voice';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
@@ -14,27 +14,56 @@ type Trend = 'besser' | 'gleich' | 'schlechter';
type TodoStatus = 'open' | 'done' | 'dropped'; type TodoStatus = 'open' | 'done' | 'dropped';
export function ReflexionRoute() { export function ReflexionRoute() {
const today = trpc.dayEntry.today.useQuery(); const [params] = useSearchParams();
const dateParam = params.get('date') ?? undefined;
const navigate = useNavigate(); const navigate = useNavigate();
if (today.isPending) return <SkeletonCard lines={6} />; // Ohne ?date: heutige Reflexion. Mit ?date: nachträglich aus der Historie.
if (!today.data?.entry) { const todayQ = trpc.dayEntry.today.useQuery(undefined, { enabled: !dateParam });
const pastQ = trpc.dayEntry.ownForDate.useQuery(
{ date: dateParam ?? '' },
{ enabled: !!dateParam },
);
const active = dateParam ? pastQ : todayQ;
if (active.isPending) return <SkeletonCard lines={6} />;
const entry = active.data?.entry ?? null;
const todos = active.data?.todos ?? [];
const editable = dateParam ? (pastQ.data?.editable ?? false) : true;
if (!entry) {
return ( return (
<div className="mx-auto max-w-2xl text-center"> <div className="mx-auto max-w-2xl text-center">
<p className="text-[var(--color-ink-muted)]"> <p className="text-[var(--color-ink-muted)]">
Du bist heute noch nicht locked in. {voice.hint.notCheckedInToday} {dateParam
? 'Für diesen Tag gibt es keinen Eintrag von dir.'
: `Du bist heute noch nicht locked in. ${voice.hint.notCheckedInToday}`}
</p> </p>
<Button className="mt-4" onClick={() => navigate('/heute')}> <Button className="mt-4" onClick={() => navigate(dateParam ? '/historie' : '/heute')}>
Zum Lock-in {dateParam ? 'Zur Historie' : 'Zum Lock-in'}
</Button>
</div>
);
}
if (!editable) {
return (
<div className="mx-auto max-w-2xl text-center">
<p className="text-[var(--color-ink-muted)]">
Dieser Tag ist älter als 3 Tage und kann nicht mehr bearbeitet werden.
</p>
<Button className="mt-4" onClick={() => navigate('/historie')}>
Zur Historie
</Button> </Button>
</div> </div>
); );
} }
return ( return (
<ReflectForm <ReflectForm
entry={today.data.entry} entry={entry}
todos={today.data.todos} todos={todos}
onDone={() => navigate('/dashboard')} allowUnplanned={!dateParam}
onDone={() => navigate(dateParam ? '/historie' : '/dashboard')}
/> />
); );
} }
@@ -42,24 +71,32 @@ export function ReflexionRoute() {
function ReflectForm({ function ReflectForm({
entry, entry,
todos, todos,
allowUnplanned = true,
onDone, onDone,
}: { }: {
entry: { id: string }; entry: {
id: string;
reflectionText?: string | null;
ampel?: Ampel | null;
trend?: Trend | null;
};
todos: Array<{ todos: Array<{
id: string; id: string;
title: string; title: string;
status: TodoStatus; status: TodoStatus;
bezugKind: 'project' | 'deal' | 'campaign' | 'allgemein' | null; bezugKind: 'project' | 'deal' | 'campaign' | 'allgemein' | null;
unplanned?: boolean; unplanned?: boolean;
dropReason?: string | null;
}>; }>;
allowUnplanned?: boolean;
onDone: () => void; onDone: () => void;
}) { }) {
const [todoStates, setTodoStates] = useState< const [todoStates, setTodoStates] = useState<
Record<string, { status: TodoStatus; reason?: string }> Record<string, { status: TodoStatus; reason?: string }>
>(Object.fromEntries(todos.map((t) => [t.id, { status: t.status }]))); >(Object.fromEntries(todos.map((t) => [t.id, { status: t.status, reason: t.dropReason ?? '' }])));
const [reflectionText, setReflectionText] = useState(''); const [reflectionText, setReflectionText] = useState(entry.reflectionText ?? '');
const [ampel, setAmpel] = useState<Ampel | null>(null); const [ampel, setAmpel] = useState<Ampel | null>(entry.ampel ?? null);
const [trend, setTrend] = useState<Trend | null>(null); const [trend, setTrend] = useState<Trend | null>(entry.trend ?? null);
const [blockerEnabled, setBlockerEnabled] = useState(false); const [blockerEnabled, setBlockerEnabled] = useState(false);
const [blockerTitle, setBlockerTitle] = useState(''); const [blockerTitle, setBlockerTitle] = useState('');
const [blockerDescription, setBlockerDescription] = useState(''); const [blockerDescription, setBlockerDescription] = useState('');
@@ -86,6 +123,10 @@ function ReflectForm({
setTodoStates((prev) => ({ ...prev, [id]: { ...prev[id], status } })); setTodoStates((prev) => ({ ...prev, [id]: { ...prev[id], status } }));
} }
function setTodoReason(id: string, reason: string) {
setTodoStates((prev) => ({ ...prev, [id]: { status: prev[id]?.status ?? 'open', reason } }));
}
function handleSubmit(e: React.FormEvent) { function handleSubmit(e: React.FormEvent) {
e.preventDefault(); e.preventDefault();
if (!ampel) { if (!ampel) {
@@ -107,7 +148,7 @@ function ReflectForm({
todos: todos.map((t) => ({ todos: todos.map((t) => ({
id: t.id, id: t.id,
status: todoStates[t.id]?.status ?? t.status, status: todoStates[t.id]?.status ?? t.status,
dropReason: todoStates[t.id]?.reason, dropReason: todoStates[t.id]?.reason?.trim() || undefined,
})), })),
reflectionText, reflectionText,
ampel, ampel,
@@ -138,7 +179,8 @@ function ReflectForm({
{todos.map((t) => { {todos.map((t) => {
const status = todoStates[t.id]?.status ?? t.status; const status = todoStates[t.id]?.status ?? t.status;
return ( return (
<li key={t.id} className="flex items-center gap-2"> <li key={t.id} className="space-y-1">
<div className="flex items-center gap-2">
<EditableTodoTitle id={t.id} title={t.title} /> <EditableTodoTitle id={t.id} title={t.title} />
{t.unplanned && ( {t.unplanned && (
<span className="rounded-full bg-black/5 px-1.5 py-0.5 text-[10px] text-[var(--color-ink-muted)]"> <span className="rounded-full bg-black/5 px-1.5 py-0.5 text-[10px] text-[var(--color-ink-muted)]">
@@ -168,10 +210,21 @@ function ReflectForm({
<X size={14} /> <X size={14} />
</StatusBtn> </StatusBtn>
</div> </div>
</div>
<input
type="text"
value={todoStates[t.id]?.reason ?? ''}
onChange={(e) => setTodoReason(t.id, e.target.value)}
placeholder="Notiz (optional) — Ergebnis, Kontext, Link …"
maxLength={500}
aria-label={`Notiz zu ${t.title}`}
className="w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-white px-2 py-1 text-xs focus:border-[var(--color-ink)] focus:outline-none"
/>
</li> </li>
); );
})} })}
</ul> </ul>
{allowUnplanned && (
<div className="mt-1 flex items-center gap-2"> <div className="mt-1 flex items-center gap-2">
<input <input
type="text" type="text"
@@ -198,6 +251,7 @@ function ReflectForm({
Erledigt eintragen Erledigt eintragen
</Button> </Button>
</div> </div>
)}
</Card.Body> </Card.Body>
</Card.Root> </Card.Root>
@@ -391,7 +445,7 @@ function EditableTodoTitle({ id, title }: { id: string; title: string }) {
<span>{title}</span> <span>{title}</span>
<Pencil <Pencil
size={12} size={12}
className="text-[var(--color-ink-faint)] opacity-0 transition-opacity group-hover:opacity-100" className="text-[var(--color-ink-faint)] opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100"
/> />
</button> </button>
); );
+18 -4
View File
@@ -5,6 +5,7 @@ import { trpc } from '../lib/trpc';
import { Card } from '../components/ui/Card'; import { Card } from '../components/ui/Card';
import { Button } from '../components/ui/Button'; import { Button } from '../components/ui/Button';
import { SkeletonCard } from '../components/ui/SkeletonCard'; import { SkeletonCard } from '../components/ui/SkeletonCard';
import { ErrorState } from '../components/ui/ErrorState';
import { formatDurationCompact } from '../lib/format-duration'; import { formatDurationCompact } from '../lib/format-duration';
import { TIME_CATEGORIES } from '../lib/time-categories'; import { TIME_CATEGORIES } from '../lib/time-categories';
@@ -113,7 +114,10 @@ function layout(entries: RawEntry[], nowMs: number): { bars: Bar[]; rows: number
export function TeamViewRoute() { export function TeamViewRoute() {
const [date, setDate] = useState(todayStr); const [date, setDate] = useState(todayStr);
const isToday = date === todayStr; const isToday = date === todayStr;
const q = trpc.time.teamTimeline.useQuery({ date }, { refetchInterval: isToday ? 30_000 : false }); const q = trpc.time.teamTimeline.useQuery(
{ date },
{ refetchInterval: isToday ? 30_000 : false },
);
// 1-Sekunden-Tick nur heute (für laufende Balken). // 1-Sekunden-Tick nur heute (für laufende Balken).
const [, setTick] = useState(0); const [, setTick] = useState(0);
@@ -124,7 +128,13 @@ export function TeamViewRoute() {
}, [isToday]); }, [isToday]);
if (q.isPending) return <SkeletonCard lines={6} />; if (q.isPending) return <SkeletonCard lines={6} />;
if (!q.data) return null; if (q.isError || !q.data)
return (
<ErrorState
message="Team-Ansicht konnte nicht geladen werden."
onRetry={() => void q.refetch()}
/>
);
const lanes = q.data.lanes; const lanes = q.data.lanes;
const nowMs = Date.now(); const nowMs = Date.now();
@@ -141,7 +151,8 @@ export function TeamViewRoute() {
let axisEnd = hasData ? ceilHourMs(Math.max(...allMs)) : axisStart + 2 * 3600_000; let axisEnd = hasData ? ceilHourMs(Math.max(...allMs)) : axisStart + 2 * 3600_000;
if (axisEnd - axisStart < 2 * 3600_000) axisEnd = axisStart + 2 * 3600_000; if (axisEnd - axisStart < 2 * 3600_000) axisEnd = axisStart + 2 * 3600_000;
const range = axisEnd - axisStart; const range = axisEnd - axisStart;
const pct = (ms: number) => ((Math.min(Math.max(ms, axisStart), axisEnd) - axisStart) / range) * 100; const pct = (ms: number) =>
((Math.min(Math.max(ms, axisStart), axisEnd) - axisStart) / range) * 100;
const hours: number[] = []; const hours: number[] = [];
for (let t = axisStart; t <= axisEnd; t += 3600_000) hours.push(t); for (let t = axisStart; t <= axisEnd; t += 3600_000) hours.push(t);
@@ -221,7 +232,10 @@ export function TeamViewRoute() {
const { bars, rows } = layout(lane.entries, nowMs); const { bars, rows } = layout(lane.entries, nowMs);
const laneHeight = rows * BAR_H + (rows - 1) * GAP; const laneHeight = rows * BAR_H + (rows - 1) * GAP;
return ( return (
<div key={lane.userId} className="flex items-stretch border-t border-[var(--color-border)] py-1.5"> <div
key={lane.userId}
className="flex items-stretch border-t border-[var(--color-border)] py-1.5"
>
<div className="flex w-40 shrink-0 flex-col justify-center pr-2"> <div className="flex w-40 shrink-0 flex-col justify-center pr-2">
<span className="truncate text-sm font-medium">{lane.name}</span> <span className="truncate text-sm font-medium">{lane.name}</span>
<span className="text-[10px] text-[var(--color-ink-muted)]"> <span className="text-[10px] text-[var(--color-ink-muted)]">
+6 -6
View File
@@ -8,9 +8,9 @@
font-weight: 300 700; font-weight: 300 700;
font-display: swap; font-display: swap;
src: url(/fonts/space-grotesk-latin.woff2) format('woff2'); src: url(/fonts/space-grotesk-latin.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, unicode-range:
U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
} }
@font-face { @font-face {
font-family: 'Space Grotesk'; font-family: 'Space Grotesk';
@@ -18,9 +18,9 @@
font-weight: 300 700; font-weight: 300 700;
font-display: swap; font-display: swap;
src: url(/fonts/space-grotesk-latin-ext.woff2) format('woff2'); src: url(/fonts/space-grotesk-latin-ext.woff2) format('woff2');
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, unicode-range:
U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
U+A720-A7FF; U+A720-A7FF;
} }
+27
View File
@@ -21,6 +21,33 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
# Backup-Sidecar: täglicher pg_dump des postgres-Service nach cockpit_backups.
# Nutzt scripts/backup.sh (Custom-Format-Dump + Retention + API-Heartbeat),
# getaktet von scripts/backup-loop.sh. Stock postgres-Image → pg_dump passt
# versionsgenau (16) zur DB. Restore: siehe docs/operations.md.
backup:
image: postgres:16-alpine
container_name: cockpit-backup
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
POSTGRES_USER: ${POSTGRES_USER:-cockpit}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB:-cockpit}
PGHOST: postgres
API_URL: http://api:3000
CRON_BEARER_TOKEN: ${CRON_BEARER_TOKEN}
BACKUP_HOUR: ${BACKUP_HOUR:-03}
BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS:-14}
TZ: Europe/Berlin
volumes:
- cockpit_backups:/backups
- ./scripts/backup.sh:/usr/local/bin/backup.sh:ro
- ./scripts/backup-loop.sh:/usr/local/bin/backup-loop.sh:ro
entrypoint: ['/bin/sh', '/usr/local/bin/backup-loop.sh']
api: api:
build: build:
context: . context: .
+25 -4
View File
@@ -54,14 +54,35 @@ docker compose exec api node -e "import('@cockpit/db/client').then(async ({ crea
## Backups (Story 6.3) ## Backups (Story 6.3)
Tägliches `pg_dump` via Cron-Endpoint `POST /internal/cron/pg-dump-backup` mit Bearer-Token. Tägliches `pg_dump` läuft im **Backup-Sidecar** (`docker-compose.yml` service `backup`):
14 Tage Retention. Restore-Drill quartalsweise. `scripts/backup-loop.sh` triggert `scripts/backup.sh` einmal pro Tag um
`BACKUP_HOUR` (Default 03:00 Europe/Berlin). Dump im **Custom-Format** (`-Fc`,
bereits komprimiert) nach `cockpit_backups:/backups` als `cockpit-<ts>.dump`.
Retention `BACKUP_RETENTION_DAYS` (Default 14). Nach jedem Lauf ein Heartbeat an
`POST /internal/cron/pg-dump-backup` (nur Logging — der Endpoint macht **kein**
Backup). Restore-Drill quartalsweise.
Konfiguration (optional, in `.env.production`): `BACKUP_HOUR`, `BACKUP_RETENTION_DAYS`.
```bash
# Status / letztes Backup ansehen
docker compose logs --tail=20 backup
docker compose exec backup ls -lh /backups
# Sofort ein Backup auslösen (außer der Reihe)
docker compose exec backup /usr/local/bin/backup.sh
```
### Restore-Anleitung ### Restore-Anleitung
1. API stoppen: `docker compose stop api` 1. API stoppen: `docker compose stop api`
2. Backup aus `/backups` auswählen. 2. Backup aus `/backups` auswählen (`docker compose exec postgres ls -lh /backups`).
3. Restore in temporäre DB: `docker compose exec postgres pg_restore -U cockpit -d cockpit_restore /backups/<file>.sql.gz` 3. Restore in temporäre DB:
```bash
docker compose exec postgres createdb -U cockpit cockpit_restore
docker compose exec postgres pg_restore -U cockpit -d cockpit_restore /backups/<file>.dump
```
(In die Produktiv-DB stattdessen mit `--clean --if-exists -d cockpit`.)
4. Smoke-Test: `curl http://localhost:3000/api/health` 4. Smoke-Test: `curl http://localhost:3000/api/health`
5. API wieder starten: `docker compose start api` 5. API wieder starten: `docker compose start api`
@@ -0,0 +1,8 @@
-- Verwaiste Verweise vor dem Setzen der Foreign Keys auf NULL bereinigen — sonst
-- schlaegt ADD CONSTRAINT fehl, falls Altdaten auf geloeschte Zeilen zeigen.
UPDATE "blocker" SET "area_id" = NULL WHERE "area_id" IS NOT NULL AND "area_id" NOT IN (SELECT "id" FROM "area");--> statement-breakpoint
UPDATE "blocker" SET "project_id" = NULL WHERE "project_id" IS NOT NULL AND "project_id" NOT IN (SELECT "id" FROM "project");--> statement-breakpoint
UPDATE "day_entry" SET "blocker_id" = NULL WHERE "blocker_id" IS NOT NULL AND "blocker_id" NOT IN (SELECT "id" FROM "blocker");--> statement-breakpoint
ALTER TABLE "blocker" ADD CONSTRAINT "blocker_area_id_area_id_fk" FOREIGN KEY ("area_id") REFERENCES "public"."area"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "blocker" ADD CONSTRAINT "blocker_project_id_project_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."project"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "day_entry" ADD CONSTRAINT "day_entry_blocker_id_blocker_id_fk" FOREIGN KEY ("blocker_id") REFERENCES "public"."blocker"("id") ON DELETE set null ON UPDATE no action;
@@ -0,0 +1 @@
ALTER TABLE "project" ADD COLUMN "lessons_learned" jsonb;
@@ -0,0 +1,4 @@
ALTER TABLE "day_entry" ADD COLUMN "auto_checked_in" boolean DEFAULT false NOT NULL;--> statement-breakpoint
UPDATE "day_entry" SET "auto_checked_in" = true
WHERE "checked_in_at" IS NOT NULL
AND ("checked_in_at" AT TIME ZONE 'Europe/Berlin')::time = TIME '06:00:00';
+42 -126
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -702,12 +674,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -831,12 +799,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -844,12 +808,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -933,12 +893,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -992,12 +948,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1005,12 +957,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1018,12 +966,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1113,12 +1057,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1309,12 +1249,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1322,12 +1258,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1335,12 +1267,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1431,12 +1359,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1577,12 +1501,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1590,12 +1510,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+42 -126
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -702,12 +674,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -831,12 +799,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -844,12 +808,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -933,12 +893,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -992,12 +948,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1005,12 +957,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1018,12 +966,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1113,12 +1057,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1309,12 +1249,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1322,12 +1258,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1335,12 +1267,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1431,12 +1359,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1611,12 +1535,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1624,12 +1544,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+48 -144
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -702,12 +674,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -831,12 +799,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -844,12 +808,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -933,12 +893,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -992,12 +948,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1005,12 +957,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1018,12 +966,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1113,12 +1057,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1309,12 +1249,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1322,12 +1258,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1335,12 +1267,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1431,12 +1359,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1593,12 +1517,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1606,12 +1526,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1619,12 +1535,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1799,12 +1711,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1812,12 +1720,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+48 -144
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -702,12 +674,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -831,12 +799,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -844,12 +808,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -933,12 +893,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -992,12 +948,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1005,12 +957,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1018,12 +966,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1113,12 +1057,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1315,12 +1255,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1328,12 +1264,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1341,12 +1273,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1437,12 +1365,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1599,12 +1523,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1612,12 +1532,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1625,12 +1541,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1805,12 +1717,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1818,12 +1726,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+62 -186
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -702,12 +674,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -831,12 +799,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -844,12 +808,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -933,12 +893,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1256,12 +1212,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1269,12 +1221,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1282,12 +1230,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1295,12 +1239,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1420,12 +1360,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1479,12 +1415,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1492,12 +1424,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1505,12 +1433,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1619,12 +1543,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1632,12 +1552,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1727,12 +1643,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1929,12 +1841,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1942,12 +1850,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1955,12 +1859,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2051,12 +1951,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2213,12 +2109,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2226,12 +2118,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2239,12 +2127,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2419,12 +2303,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2432,12 +2312,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+68 -204
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -702,12 +674,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -831,12 +799,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -844,12 +808,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -933,12 +893,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1256,12 +1212,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1269,12 +1221,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1282,12 +1230,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1295,12 +1239,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1420,12 +1360,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1479,12 +1415,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1492,12 +1424,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1505,12 +1433,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1619,12 +1543,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1632,12 +1552,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1739,12 +1655,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1954,12 +1866,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1967,12 +1875,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1980,12 +1884,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2124,12 +2024,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2137,12 +2033,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2233,12 +2125,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2348,12 +2236,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2510,12 +2394,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2523,12 +2403,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2536,12 +2412,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2716,12 +2588,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2729,12 +2597,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+82 -246
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -618,12 +590,8 @@
"name": "change_entry_project_id_project_id_fk", "name": "change_entry_project_id_project_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -631,12 +599,8 @@
"name": "change_entry_created_by_user_id_fk", "name": "change_entry_created_by_user_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -803,12 +767,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -932,12 +892,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -945,12 +901,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1034,12 +986,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1357,12 +1305,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1370,12 +1314,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1383,12 +1323,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1396,12 +1332,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1521,12 +1453,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1580,12 +1508,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1593,12 +1517,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1606,12 +1526,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1720,12 +1636,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1733,12 +1645,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1840,12 +1748,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1927,12 +1831,8 @@
"name": "phase_gate_project_id_project_id_fk", "name": "phase_gate_project_id_project_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1940,12 +1840,8 @@
"name": "phase_gate_reviewed_by_user_id_fk", "name": "phase_gate_reviewed_by_user_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["reviewed_by"],
"reviewed_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2192,12 +2088,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2205,12 +2097,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2218,12 +2106,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2312,12 +2196,8 @@
"name": "project_status_project_id_project_id_fk", "name": "project_status_project_id_project_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2325,12 +2205,8 @@
"name": "project_status_created_by_user_id_fk", "name": "project_status_created_by_user_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2481,12 +2357,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2494,12 +2366,8 @@
"name": "risk_owner_user_id_user_id_fk", "name": "risk_owner_user_id_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2507,12 +2375,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2603,12 +2467,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2718,12 +2578,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2880,12 +2736,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2893,12 +2745,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2906,12 +2754,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -3086,12 +2930,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -3099,12 +2939,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+84 -252
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -618,12 +590,8 @@
"name": "change_entry_project_id_project_id_fk", "name": "change_entry_project_id_project_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -631,12 +599,8 @@
"name": "change_entry_created_by_user_id_fk", "name": "change_entry_created_by_user_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -803,12 +767,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -932,12 +892,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -945,12 +901,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1034,12 +986,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1378,12 +1326,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1391,12 +1335,8 @@
"name": "lead_project_id_project_id_fk", "name": "lead_project_id_project_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1404,12 +1344,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1417,12 +1353,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1430,12 +1362,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1555,12 +1483,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1614,12 +1538,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1627,12 +1547,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1640,12 +1556,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1754,12 +1666,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1767,12 +1675,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1874,12 +1778,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1961,12 +1861,8 @@
"name": "phase_gate_project_id_project_id_fk", "name": "phase_gate_project_id_project_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1974,12 +1870,8 @@
"name": "phase_gate_reviewed_by_user_id_fk", "name": "phase_gate_reviewed_by_user_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["reviewed_by"],
"reviewed_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2226,12 +2118,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2239,12 +2127,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2252,12 +2136,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2346,12 +2226,8 @@
"name": "project_status_project_id_project_id_fk", "name": "project_status_project_id_project_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2359,12 +2235,8 @@
"name": "project_status_created_by_user_id_fk", "name": "project_status_created_by_user_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2515,12 +2387,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2528,12 +2396,8 @@
"name": "risk_owner_user_id_user_id_fk", "name": "risk_owner_user_id_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2541,12 +2405,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2637,12 +2497,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2752,12 +2608,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2914,12 +2766,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2927,12 +2775,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2940,12 +2784,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -3120,12 +2960,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -3133,12 +2969,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+84 -252
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -618,12 +590,8 @@
"name": "change_entry_project_id_project_id_fk", "name": "change_entry_project_id_project_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -631,12 +599,8 @@
"name": "change_entry_created_by_user_id_fk", "name": "change_entry_created_by_user_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -803,12 +767,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -932,12 +892,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -945,12 +901,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1034,12 +986,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1378,12 +1326,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1391,12 +1335,8 @@
"name": "lead_project_id_project_id_fk", "name": "lead_project_id_project_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1404,12 +1344,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1417,12 +1353,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1430,12 +1362,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1555,12 +1483,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1614,12 +1538,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1627,12 +1547,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1640,12 +1556,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1754,12 +1666,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1767,12 +1675,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1874,12 +1778,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1961,12 +1861,8 @@
"name": "phase_gate_project_id_project_id_fk", "name": "phase_gate_project_id_project_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1974,12 +1870,8 @@
"name": "phase_gate_reviewed_by_user_id_fk", "name": "phase_gate_reviewed_by_user_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["reviewed_by"],
"reviewed_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2226,12 +2118,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2239,12 +2127,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2252,12 +2136,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2346,12 +2226,8 @@
"name": "project_status_project_id_project_id_fk", "name": "project_status_project_id_project_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2359,12 +2235,8 @@
"name": "project_status_created_by_user_id_fk", "name": "project_status_created_by_user_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2515,12 +2387,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2528,12 +2396,8 @@
"name": "risk_owner_user_id_user_id_fk", "name": "risk_owner_user_id_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2541,12 +2405,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2637,12 +2497,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2752,12 +2608,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2914,12 +2766,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2927,12 +2775,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2940,12 +2784,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -3127,12 +2967,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -3140,12 +2976,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+84 -252
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -618,12 +590,8 @@
"name": "change_entry_project_id_project_id_fk", "name": "change_entry_project_id_project_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -631,12 +599,8 @@
"name": "change_entry_created_by_user_id_fk", "name": "change_entry_created_by_user_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -803,12 +767,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -932,12 +892,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -945,12 +901,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1034,12 +986,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1378,12 +1326,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1391,12 +1335,8 @@
"name": "lead_project_id_project_id_fk", "name": "lead_project_id_project_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1404,12 +1344,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1417,12 +1353,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1430,12 +1362,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1555,12 +1483,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1614,12 +1538,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1627,12 +1547,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1640,12 +1556,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1754,12 +1666,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1767,12 +1675,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1874,12 +1778,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1961,12 +1861,8 @@
"name": "phase_gate_project_id_project_id_fk", "name": "phase_gate_project_id_project_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1974,12 +1870,8 @@
"name": "phase_gate_reviewed_by_user_id_fk", "name": "phase_gate_reviewed_by_user_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["reviewed_by"],
"reviewed_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2226,12 +2118,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2239,12 +2127,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2252,12 +2136,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2346,12 +2226,8 @@
"name": "project_status_project_id_project_id_fk", "name": "project_status_project_id_project_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2359,12 +2235,8 @@
"name": "project_status_created_by_user_id_fk", "name": "project_status_created_by_user_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2515,12 +2387,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2528,12 +2396,8 @@
"name": "risk_owner_user_id_user_id_fk", "name": "risk_owner_user_id_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2541,12 +2405,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2637,12 +2497,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2752,12 +2608,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2914,12 +2766,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2927,12 +2775,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2940,12 +2784,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -3127,12 +2967,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -3140,12 +2976,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+84 -252
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -618,12 +590,8 @@
"name": "change_entry_project_id_project_id_fk", "name": "change_entry_project_id_project_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -631,12 +599,8 @@
"name": "change_entry_created_by_user_id_fk", "name": "change_entry_created_by_user_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -822,12 +786,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -951,12 +911,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -964,12 +920,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1053,12 +1005,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1397,12 +1345,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1410,12 +1354,8 @@
"name": "lead_project_id_project_id_fk", "name": "lead_project_id_project_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1423,12 +1363,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1436,12 +1372,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1449,12 +1381,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1574,12 +1502,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1633,12 +1557,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1646,12 +1566,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1659,12 +1575,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1773,12 +1685,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1786,12 +1694,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1893,12 +1797,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1980,12 +1880,8 @@
"name": "phase_gate_project_id_project_id_fk", "name": "phase_gate_project_id_project_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1993,12 +1889,8 @@
"name": "phase_gate_reviewed_by_user_id_fk", "name": "phase_gate_reviewed_by_user_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["reviewed_by"],
"reviewed_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2245,12 +2137,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2258,12 +2146,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2271,12 +2155,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2365,12 +2245,8 @@
"name": "project_status_project_id_project_id_fk", "name": "project_status_project_id_project_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2378,12 +2254,8 @@
"name": "project_status_created_by_user_id_fk", "name": "project_status_created_by_user_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2534,12 +2406,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2547,12 +2415,8 @@
"name": "risk_owner_user_id_user_id_fk", "name": "risk_owner_user_id_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2560,12 +2424,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2656,12 +2516,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2771,12 +2627,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2933,12 +2785,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2946,12 +2794,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2959,12 +2803,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -3146,12 +2986,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -3159,12 +2995,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+84 -252
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -618,12 +590,8 @@
"name": "change_entry_project_id_project_id_fk", "name": "change_entry_project_id_project_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -631,12 +599,8 @@
"name": "change_entry_created_by_user_id_fk", "name": "change_entry_created_by_user_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -822,12 +786,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -951,12 +911,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -964,12 +920,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1053,12 +1005,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1397,12 +1345,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1410,12 +1354,8 @@
"name": "lead_project_id_project_id_fk", "name": "lead_project_id_project_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1423,12 +1363,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1436,12 +1372,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1449,12 +1381,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1574,12 +1502,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1633,12 +1557,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1646,12 +1566,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1659,12 +1575,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1773,12 +1685,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1786,12 +1694,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1893,12 +1797,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1980,12 +1880,8 @@
"name": "phase_gate_project_id_project_id_fk", "name": "phase_gate_project_id_project_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1993,12 +1889,8 @@
"name": "phase_gate_reviewed_by_user_id_fk", "name": "phase_gate_reviewed_by_user_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["reviewed_by"],
"reviewed_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2245,12 +2137,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2258,12 +2146,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2271,12 +2155,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2365,12 +2245,8 @@
"name": "project_status_project_id_project_id_fk", "name": "project_status_project_id_project_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2378,12 +2254,8 @@
"name": "project_status_created_by_user_id_fk", "name": "project_status_created_by_user_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2534,12 +2406,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2547,12 +2415,8 @@
"name": "risk_owner_user_id_user_id_fk", "name": "risk_owner_user_id_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2560,12 +2424,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2656,12 +2516,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2771,12 +2627,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2933,12 +2785,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2946,12 +2794,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2959,12 +2803,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -3146,12 +2986,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -3159,12 +2995,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
+84 -252
View File
@@ -69,12 +69,8 @@
"name": "absence_day_user_id_user_id_fk", "name": "absence_day_user_id_user_id_fk",
"tableFrom": "absence_day", "tableFrom": "absence_day",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -261,12 +257,8 @@
"name": "audit_event_actor_user_id_user_id_fk", "name": "audit_event_actor_user_id_user_id_fk",
"tableFrom": "audit_event", "tableFrom": "audit_event",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["actor_user_id"],
"actor_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -402,12 +394,8 @@
"name": "blocker_owner_user_id_user_id_fk", "name": "blocker_owner_user_id_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -415,12 +403,8 @@
"name": "blocker_opened_by_user_id_fk", "name": "blocker_opened_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["opened_by"],
"opened_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -428,12 +412,8 @@
"name": "blocker_resolved_by_user_id_fk", "name": "blocker_resolved_by_user_id_fk",
"tableFrom": "blocker", "tableFrom": "blocker",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["resolved_by"],
"resolved_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -517,12 +497,8 @@
"name": "campaign_area_id_area_id_fk", "name": "campaign_area_id_area_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -530,12 +506,8 @@
"name": "campaign_owner_user_id_user_id_fk", "name": "campaign_owner_user_id_user_id_fk",
"tableFrom": "campaign", "tableFrom": "campaign",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -618,12 +590,8 @@
"name": "change_entry_project_id_project_id_fk", "name": "change_entry_project_id_project_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -631,12 +599,8 @@
"name": "change_entry_created_by_user_id_fk", "name": "change_entry_created_by_user_id_fk",
"tableFrom": "change_entry", "tableFrom": "change_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -822,12 +786,8 @@
"name": "day_entry_user_id_user_id_fk", "name": "day_entry_user_id_user_id_fk",
"tableFrom": "day_entry", "tableFrom": "day_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -951,12 +911,8 @@
"name": "deal_area_id_area_id_fk", "name": "deal_area_id_area_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -964,12 +920,8 @@
"name": "deal_owner_user_id_user_id_fk", "name": "deal_owner_user_id_user_id_fk",
"tableFrom": "deal", "tableFrom": "deal",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1053,12 +1005,8 @@
"name": "gtm_step_owner_user_id_user_id_fk", "name": "gtm_step_owner_user_id_user_id_fk",
"tableFrom": "gtm_step", "tableFrom": "gtm_step",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1397,12 +1345,8 @@
"name": "lead_area_id_area_id_fk", "name": "lead_area_id_area_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1410,12 +1354,8 @@
"name": "lead_project_id_project_id_fk", "name": "lead_project_id_project_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1423,12 +1363,8 @@
"name": "lead_owner_user_id_user_id_fk", "name": "lead_owner_user_id_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1436,12 +1372,8 @@
"name": "lead_promoted_deal_id_deal_id_fk", "name": "lead_promoted_deal_id_deal_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["promoted_deal_id"],
"promoted_deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1449,12 +1381,8 @@
"name": "lead_created_by_user_id_fk", "name": "lead_created_by_user_id_fk",
"tableFrom": "lead", "tableFrom": "lead",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1574,12 +1502,8 @@
"name": "lead_contact_lead_id_lead_id_fk", "name": "lead_contact_lead_id_lead_id_fk",
"tableFrom": "lead_contact", "tableFrom": "lead_contact",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1633,12 +1557,8 @@
"name": "lead_handover_campaign_id_campaign_id_fk", "name": "lead_handover_campaign_id_campaign_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "campaign", "tableTo": "campaign",
"columnsFrom": [ "columnsFrom": ["campaign_id"],
"campaign_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1646,12 +1566,8 @@
"name": "lead_handover_deal_id_deal_id_fk", "name": "lead_handover_deal_id_deal_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "deal", "tableTo": "deal",
"columnsFrom": [ "columnsFrom": ["deal_id"],
"deal_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1659,12 +1575,8 @@
"name": "lead_handover_uebergeben_von_user_id_fk", "name": "lead_handover_uebergeben_von_user_id_fk",
"tableFrom": "lead_handover", "tableFrom": "lead_handover",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["uebergeben_von"],
"uebergeben_von" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1773,12 +1685,8 @@
"name": "lead_touchpoint_lead_id_lead_id_fk", "name": "lead_touchpoint_lead_id_lead_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "lead", "tableTo": "lead",
"columnsFrom": [ "columnsFrom": ["lead_id"],
"lead_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1786,12 +1694,8 @@
"name": "lead_touchpoint_bearbeiter_user_id_user_id_fk", "name": "lead_touchpoint_bearbeiter_user_id_user_id_fk",
"tableFrom": "lead_touchpoint", "tableFrom": "lead_touchpoint",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["bearbeiter_user_id"],
"bearbeiter_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1893,12 +1797,8 @@
"name": "milestone_project_id_project_id_fk", "name": "milestone_project_id_project_id_fk",
"tableFrom": "milestone", "tableFrom": "milestone",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -1980,12 +1880,8 @@
"name": "phase_gate_project_id_project_id_fk", "name": "phase_gate_project_id_project_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -1993,12 +1889,8 @@
"name": "phase_gate_reviewed_by_user_id_fk", "name": "phase_gate_reviewed_by_user_id_fk",
"tableFrom": "phase_gate", "tableFrom": "phase_gate",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["reviewed_by"],
"reviewed_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2251,12 +2143,8 @@
"name": "project_area_id_area_id_fk", "name": "project_area_id_area_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "area", "tableTo": "area",
"columnsFrom": [ "columnsFrom": ["area_id"],
"area_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "restrict", "onDelete": "restrict",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2264,12 +2152,8 @@
"name": "project_verantwortliche_user_id_user_id_fk", "name": "project_verantwortliche_user_id_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["verantwortliche_user_id"],
"verantwortliche_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2277,12 +2161,8 @@
"name": "project_created_by_user_id_fk", "name": "project_created_by_user_id_fk",
"tableFrom": "project", "tableFrom": "project",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2371,12 +2251,8 @@
"name": "project_status_project_id_project_id_fk", "name": "project_status_project_id_project_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2384,12 +2260,8 @@
"name": "project_status_created_by_user_id_fk", "name": "project_status_created_by_user_id_fk",
"tableFrom": "project_status", "tableFrom": "project_status",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2540,12 +2412,8 @@
"name": "risk_project_id_project_id_fk", "name": "risk_project_id_project_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2553,12 +2421,8 @@
"name": "risk_owner_user_id_user_id_fk", "name": "risk_owner_user_id_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["owner_user_id"],
"owner_user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2566,12 +2430,8 @@
"name": "risk_created_by_user_id_fk", "name": "risk_created_by_user_id_fk",
"tableFrom": "risk", "tableFrom": "risk",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["created_by"],
"created_by" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2662,12 +2522,8 @@
"name": "session_user_id_user_id_fk", "name": "session_user_id_user_id_fk",
"tableFrom": "session", "tableFrom": "session",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2777,12 +2633,8 @@
"name": "stakeholder_project_id_project_id_fk", "name": "stakeholder_project_id_project_id_fk",
"tableFrom": "stakeholder", "tableFrom": "stakeholder",
"tableTo": "project", "tableTo": "project",
"columnsFrom": [ "columnsFrom": ["project_id"],
"project_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -2939,12 +2791,8 @@
"name": "time_entry_user_id_user_id_fk", "name": "time_entry_user_id_user_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2952,12 +2800,8 @@
"name": "time_entry_day_entry_id_day_entry_id_fk", "name": "time_entry_day_entry_id_day_entry_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -2965,12 +2809,8 @@
"name": "time_entry_todo_id_todo_id_fk", "name": "time_entry_todo_id_todo_id_fk",
"tableFrom": "time_entry", "tableFrom": "time_entry",
"tableTo": "todo", "tableTo": "todo",
"columnsFrom": [ "columnsFrom": ["todo_id"],
"todo_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "set null", "onDelete": "set null",
"onUpdate": "no action" "onUpdate": "no action"
} }
@@ -3152,12 +2992,8 @@
"name": "todo_day_entry_id_day_entry_id_fk", "name": "todo_day_entry_id_day_entry_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "day_entry", "tableTo": "day_entry",
"columnsFrom": [ "columnsFrom": ["day_entry_id"],
"day_entry_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
}, },
@@ -3165,12 +3001,8 @@
"name": "todo_user_id_user_id_fk", "name": "todo_user_id_user_id_fk",
"tableFrom": "todo", "tableFrom": "todo",
"tableTo": "user", "tableTo": "user",
"columnsFrom": [ "columnsFrom": ["user_id"],
"user_id" "columnsTo": ["id"],
],
"columnsTo": [
"id"
],
"onDelete": "cascade", "onDelete": "cascade",
"onUpdate": "no action" "onUpdate": "no action"
} }
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+21
View File
@@ -120,6 +120,27 @@
"when": 1780771242601, "when": 1780771242601,
"tag": "0016_project_logo_url", "tag": "0016_project_logo_url",
"breakpoints": true "breakpoints": true
},
{
"idx": 17,
"version": "7",
"when": 1780826387755,
"tag": "0017_rare_oracle",
"breakpoints": true
},
{
"idx": 18,
"version": "7",
"when": 1780828837324,
"tag": "0018_last_lake",
"breakpoints": true
},
{
"idx": 19,
"version": "7",
"when": 1781259091924,
"tag": "0019_shocking_starbolt",
"breakpoints": true
} }
] ]
} }
+23 -6
View File
@@ -166,6 +166,14 @@ export const project = pgTable(
lessonsLearnedUrl: text('lessons_learned_url'), lessonsLearnedUrl: text('lessons_learned_url'),
// Abschluss (Leitfaden Phase 4): kurzer Abschlussvermerk — Ziel erreicht? Aufwand vs. Plan? // Abschluss (Leitfaden Phase 4): kurzer Abschlussvermerk — Ziel erreicht? Aufwand vs. Plan?
abschlussvermerk: text('abschlussvermerk'), abschlussvermerk: text('abschlussvermerk'),
// Strukturierte Retrospektive (Lessons-Learned-Vorlage). Ersetzt die freie
// Vermerk-Textarea durch geführte Felder; alte Einträge nutzen abschlussvermerk.
lessonsLearned: jsonb('lessons_learned').$type<{
zielErreicht: string;
aufwand: string;
liefGut: string;
liefSchlecht: string;
} | null>(),
createdBy: uuid('created_by').references(() => user.id, { onDelete: 'set null' }), createdBy: uuid('created_by').references(() => user.id, { onDelete: 'set null' }),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(), createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(), updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
@@ -221,6 +229,9 @@ export const dayEntry = pgTable(
date: date('date').notNull(), // YYYY-MM-DD im Europe/Berlin date: date('date').notNull(), // YYYY-MM-DD im Europe/Berlin
status: text('status', { enum: ['begun', 'full', 'absent'] }).notNull(), status: text('status', { enum: ['begun', 'full', 'absent'] }).notNull(),
checkedInAt: timestamp('checked_in_at', { withTimezone: true }), checkedInAt: timestamp('checked_in_at', { withTimezone: true }),
// True, wenn der Eintrag vom 6-Uhr-Schnitt automatisch angelegt wurde (kein
// echter Lock-in um 06:00) — Anwesenheits-Anzeigen ignorieren solche Check-ins.
autoCheckedIn: boolean('auto_checked_in').notNull().default(false),
// Arbeitsende (Check-Out) — markiert das Ende der Arbeits-Session des Tages. // Arbeitsende (Check-Out) — markiert das Ende der Arbeits-Session des Tages.
checkedOutAt: timestamp('checked_out_at', { withTimezone: true }), checkedOutAt: timestamp('checked_out_at', { withTimezone: true }),
// Kimai-Sync: ID des bei Check-In gestarteten Timesheets + Sync-Status. // Kimai-Sync: ID des bei Check-In gestarteten Timesheets + Sync-Status.
@@ -231,7 +242,7 @@ export const dayEntry = pgTable(
ampel: text('ampel', { enum: ['green', 'amber', 'red'] }), ampel: text('ampel', { enum: ['green', 'amber', 'red'] }),
trend: text('trend', { enum: ['besser', 'gleich', 'schlechter'] }), trend: text('trend', { enum: ['besser', 'gleich', 'schlechter'] }),
url: text('url'), url: text('url'),
blockerId: uuid('blocker_id'), blockerId: uuid('blocker_id').references(() => blocker.id, { onDelete: 'set null' }),
editLockedAt: timestamp('edit_locked_at', { withTimezone: true }), editLockedAt: timestamp('edit_locked_at', { withTimezone: true }),
publishedAt: timestamp('published_at', { withTimezone: true }), publishedAt: timestamp('published_at', { withTimezone: true }),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(), createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
@@ -402,8 +413,12 @@ export const leadHandover = pgTable('lead_handover', {
export const timeEntry = pgTable( export const timeEntry = pgTable(
'time_entry', 'time_entry',
{ {
id: uuid('id').default(sql`gen_random_uuid()`).primaryKey(), id: uuid('id')
userId: uuid('user_id').notNull().references(() => user.id, { onDelete: 'cascade' }), .default(sql`gen_random_uuid()`)
.primaryKey(),
userId: uuid('user_id')
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),
dayEntryId: uuid('day_entry_id').references(() => dayEntry.id, { onDelete: 'set null' }), dayEntryId: uuid('day_entry_id').references(() => dayEntry.id, { onDelete: 'set null' }),
todoId: uuid('todo_id').references(() => todo.id, { onDelete: 'set null' }), todoId: uuid('todo_id').references(() => todo.id, { onDelete: 'set null' }),
bezugKind: text('bezug_kind', { enum: ['project', 'deal', 'campaign', 'allgemein'] }), bezugKind: text('bezug_kind', { enum: ['project', 'deal', 'campaign', 'allgemein'] }),
@@ -442,8 +457,8 @@ export const blocker = pgTable(
.primaryKey(), .primaryKey(),
title: text('title').notNull(), title: text('title').notNull(),
description: text('description'), description: text('description'),
areaId: uuid('area_id'), areaId: uuid('area_id').references(() => area.id, { onDelete: 'set null' }),
projectId: uuid('project_id'), projectId: uuid('project_id').references(() => project.id, { onDelete: 'set null' }),
ownerUserId: uuid('owner_user_id').references(() => user.id, { onDelete: 'set null' }), ownerUserId: uuid('owner_user_id').references(() => user.id, { onDelete: 'set null' }),
openedBy: uuid('opened_by') openedBy: uuid('opened_by')
.notNull() .notNull()
@@ -590,7 +605,9 @@ export const leadTouchpoint = pgTable(
kanal: text('kanal', { kanal: text('kanal', {
enum: ['call', 'mail', 'linkedin', 'termin', 'event', 'sonstiges'], enum: ['call', 'mail', 'linkedin', 'termin', 'event', 'sonstiges'],
}).notNull(), }).notNull(),
bearbeiterUserId: uuid('bearbeiter_user_id').references(() => user.id, { onDelete: 'set null' }), bearbeiterUserId: uuid('bearbeiter_user_id').references(() => user.id, {
onDelete: 'set null',
}),
inhalt: text('inhalt').notNull(), inhalt: text('inhalt').notNull(),
outcome: text('outcome'), outcome: text('outcome'),
followUpBis: date('follow_up_bis'), followUpBis: date('follow_up_bis'),
+182 -26
View File
@@ -210,12 +210,48 @@ export async function seed(connectionString: string): Promise<void> {
if (proj1 && proj2 && proj3) { if (proj1 && proj2 && proj3) {
await db.insert(milestone).values([ await db.insert(milestone).values([
{ projectId: proj1.id, title: 'Auftragsformular Phase 1', due: isoDateOffset(-5), status: 'done', order: 0 }, {
{ projectId: proj1.id, title: 'Stripe Webhook-Tests', due: isoDateOffset(10), status: 'open', order: 1 }, projectId: proj1.id,
{ projectId: proj1.id, title: 'Pilot mit Kunde', due: isoDateOffset(25), status: 'open', order: 2 }, title: 'Auftragsformular Phase 1',
{ projectId: proj2.id, title: 'Tagesrhythmus produktiv', due: isoDateOffset(5), status: 'open', order: 0 }, due: isoDateOffset(-5),
{ projectId: proj2.id, title: 'Pflicht-Minimum vollständig', due: isoDateOffset(20), status: 'open', order: 1 }, status: 'done',
{ projectId: proj3.id, title: 'Token-Refresh Bugfix', due: isoDateOffset(-3), status: 'overdue', order: 0 }, order: 0,
},
{
projectId: proj1.id,
title: 'Stripe Webhook-Tests',
due: isoDateOffset(10),
status: 'open',
order: 1,
},
{
projectId: proj1.id,
title: 'Pilot mit Kunde',
due: isoDateOffset(25),
status: 'open',
order: 2,
},
{
projectId: proj2.id,
title: 'Tagesrhythmus produktiv',
due: isoDateOffset(5),
status: 'open',
order: 0,
},
{
projectId: proj2.id,
title: 'Pflicht-Minimum vollständig',
due: isoDateOffset(20),
status: 'open',
order: 1,
},
{
projectId: proj3.id,
title: 'Token-Refresh Bugfix',
due: isoDateOffset(-3),
status: 'overdue',
order: 0,
},
]); ]);
} }
} }
@@ -225,10 +261,38 @@ export async function seed(connectionString: string): Promise<void> {
if (existingDeals.length === 0) { if (existingDeals.length === 0) {
const sales = areaBySlug.vertrieb!; const sales = areaBySlug.vertrieb!;
await db.insert(deal).values([ await db.insert(deal).values([
{ areaId: sales.id, name: 'Schmidt & Söhne Wartungsvertrag', ownerUserId: anna.id, valueEur: 1_200_000, probability: 70, stage: 'angebot' }, {
{ areaId: sales.id, name: 'Bauwerk AG Plattform', ownerUserId: anna.id, valueEur: 850_000, probability: 50, stage: 'demo' }, areaId: sales.id,
{ areaId: sales.id, name: 'Müller GmbH Onboarding', ownerUserId: anna.id, valueEur: 250_000, probability: 30, stage: 'erstgespraech' }, name: 'Schmidt & Söhne Wartungsvertrag',
{ areaId: sales.id, name: 'Hartmann KG Pilot', ownerUserId: anna.id, valueEur: 180_000, probability: 80, stage: 'angebot' }, ownerUserId: anna.id,
valueEur: 1_200_000,
probability: 70,
stage: 'angebot',
},
{
areaId: sales.id,
name: 'Bauwerk AG Plattform',
ownerUserId: anna.id,
valueEur: 850_000,
probability: 50,
stage: 'demo',
},
{
areaId: sales.id,
name: 'Müller GmbH Onboarding',
ownerUserId: anna.id,
valueEur: 250_000,
probability: 30,
stage: 'erstgespraech',
},
{
areaId: sales.id,
name: 'Hartmann KG Pilot',
ownerUserId: anna.id,
valueEur: 180_000,
probability: 80,
stage: 'angebot',
},
{ {
areaId: sales.id, areaId: sales.id,
name: 'Becker Logistik Phase 1', name: 'Becker Logistik Phase 1',
@@ -246,9 +310,27 @@ export async function seed(connectionString: string): Promise<void> {
const existingGtm = await db.select().from(gtmStep); const existingGtm = await db.select().from(gtmStep);
if (existingGtm.length === 0) { if (existingGtm.length === 0) {
await db.insert(gtmStep).values([ await db.insert(gtmStep).values([
{ product: 'ToolCTRL Suite', title: 'Landingpage live', ownerUserId: marco.id, status: 'done', order: 0 }, {
{ product: 'ToolCTRL Suite', title: 'Pricing-Sheet final', ownerUserId: anna.id, status: 'in_progress', order: 1 }, product: 'ToolCTRL Suite',
{ product: 'ToolCTRL Suite', title: 'Demo-Video produzieren', ownerUserId: marco.id, status: 'open', order: 2 }, title: 'Landingpage live',
ownerUserId: marco.id,
status: 'done',
order: 0,
},
{
product: 'ToolCTRL Suite',
title: 'Pricing-Sheet final',
ownerUserId: anna.id,
status: 'in_progress',
order: 1,
},
{
product: 'ToolCTRL Suite',
title: 'Demo-Video produzieren',
ownerUserId: marco.id,
status: 'open',
order: 2,
},
]); ]);
} }
@@ -259,9 +341,27 @@ export async function seed(connectionString: string): Promise<void> {
const [c1, c2] = await db const [c1, c2] = await db
.insert(campaign) .insert(campaign)
.values([ .values([
{ areaId: mkt.id, name: 'LinkedIn Q2 Outbound', status: 'active', reach: 18500, ownerUserId: marco.id }, {
{ areaId: mkt.id, name: 'Webinar-Serie „Workflows"', status: 'active', reach: 4200, ownerUserId: marco.id }, areaId: mkt.id,
{ areaId: mkt.id, name: 'Newsletter Spring', status: 'done', reach: 2200, ownerUserId: marco.id }, name: 'LinkedIn Q2 Outbound',
status: 'active',
reach: 18500,
ownerUserId: marco.id,
},
{
areaId: mkt.id,
name: 'Webinar-Serie „Workflows"',
status: 'active',
reach: 4200,
ownerUserId: marco.id,
},
{
areaId: mkt.id,
name: 'Newsletter Spring',
status: 'done',
reach: 2200,
ownerUserId: marco.id,
},
]) ])
.returning(); .returning();
if (c1 && c2) { if (c1 && c2) {
@@ -296,9 +396,33 @@ export async function seed(connectionString: string): Promise<void> {
.returning(); .returning();
if (d1) { if (d1) {
await db.insert(todo).values([ await db.insert(todo).values([
{ dayEntryId: d1.id, userId: dejan.id, date: yesterday, title: 'Stripe-Webhook implementieren', order: 0, status: 'done', bezugKind: 'project' }, {
{ dayEntryId: d1.id, userId: dejan.id, date: yesterday, title: 'Pilot-Demo vorbereiten', order: 1, status: 'done', bezugKind: 'project' }, dayEntryId: d1.id,
{ dayEntryId: d1.id, userId: dejan.id, date: yesterday, title: 'Marketing-Briefing review', order: 2, status: 'dropped', dropReason: 'Marco war krank' }, userId: dejan.id,
date: yesterday,
title: 'Stripe-Webhook implementieren',
order: 0,
status: 'done',
bezugKind: 'project',
},
{
dayEntryId: d1.id,
userId: dejan.id,
date: yesterday,
title: 'Pilot-Demo vorbereiten',
order: 1,
status: 'done',
bezugKind: 'project',
},
{
dayEntryId: d1.id,
userId: dejan.id,
date: yesterday,
title: 'Marketing-Briefing review',
order: 2,
status: 'dropped',
dropReason: 'Marco war krank',
},
]); ]);
} }
@@ -310,7 +434,8 @@ export async function seed(connectionString: string): Promise<void> {
status: 'full', status: 'full',
checkedInAt: new Date(`${yesterday}T09:00:00+02:00`), checkedInAt: new Date(`${yesterday}T09:00:00+02:00`),
reflectedAt: new Date(`${yesterday}T18:00:00+02:00`), reflectedAt: new Date(`${yesterday}T18:00:00+02:00`),
reflectionText: 'Token-Refresh Bug reproduziert, Fix-Hypothese steht. Komme morgen weiter.', reflectionText:
'Token-Refresh Bug reproduziert, Fix-Hypothese steht. Komme morgen weiter.',
ampel: 'red', ampel: 'red',
trend: 'schlechter', trend: 'schlechter',
publishedAt: new Date(), publishedAt: new Date(),
@@ -318,8 +443,23 @@ export async function seed(connectionString: string): Promise<void> {
.returning(); .returning();
if (d2) { if (d2) {
await db.insert(todo).values([ await db.insert(todo).values([
{ dayEntryId: d2.id, userId: lukas.id, date: yesterday, title: 'Token-Refresh debuggen', order: 0, status: 'open', bezugKind: 'project' }, {
{ dayEntryId: d2.id, userId: lukas.id, date: yesterday, title: 'PR Review für Anna', order: 1, status: 'done' }, dayEntryId: d2.id,
userId: lukas.id,
date: yesterday,
title: 'Token-Refresh debuggen',
order: 0,
status: 'open',
bezugKind: 'project',
},
{
dayEntryId: d2.id,
userId: lukas.id,
date: yesterday,
title: 'PR Review für Anna',
order: 1,
status: 'done',
},
]); ]);
} }
@@ -339,8 +479,24 @@ export async function seed(connectionString: string): Promise<void> {
.returning(); .returning();
if (d3) { if (d3) {
await db.insert(todo).values([ await db.insert(todo).values([
{ dayEntryId: d3.id, userId: anna.id, date: yesterday, title: 'Hartmann-Angebot rausschicken', order: 0, status: 'done', bezugKind: 'deal' }, {
{ dayEntryId: d3.id, userId: anna.id, date: yesterday, title: 'Demo-Termin Schmidt fixieren', order: 1, status: 'done', bezugKind: 'deal' }, dayEntryId: d3.id,
userId: anna.id,
date: yesterday,
title: 'Hartmann-Angebot rausschicken',
order: 0,
status: 'done',
bezugKind: 'deal',
},
{
dayEntryId: d3.id,
userId: anna.id,
date: yesterday,
title: 'Demo-Termin Schmidt fixieren',
order: 1,
status: 'done',
bezugKind: 'deal',
},
]); ]);
} }
@@ -438,7 +594,8 @@ export async function seed(connectionString: string): Promise<void> {
datum: pickWerktag(2), datum: pickWerktag(2),
kanal: 'linkedin', kanal: 'linkedin',
bearbeiterUserId: anna.id, bearbeiterUserId: anna.id,
inhalt: 'Erste Nachricht über das MitApp-Profil geschickt, Bezug auf KI-Optimierung für PM.', inhalt:
'Erste Nachricht über das MitApp-Profil geschickt, Bezug auf KI-Optimierung für PM.',
outcome: 'positiv geantwortet, Interesse an kurzem Austausch', outcome: 'positiv geantwortet, Interesse an kurzem Austausch',
followUpBis: isoDateOffset(4), followUpBis: isoDateOffset(4),
}, },
@@ -582,7 +739,6 @@ export async function seed(connectionString: string): Promise<void> {
}); });
} }
} }
} finally { } finally {
await pool.end(); await pool.end();
} }
+3 -1
View File
@@ -28,7 +28,9 @@ export const submitReflectionInput = z.object({
z.object({ z.object({
id: z.string().uuid(), id: z.string().uuid(),
status: todoStatusSchema, status: todoStatusSchema,
dropReason: z.string().max(200).optional(), // Optionale Notiz pro Task (frühere „Verworfen-Grund"-Spalte, jetzt für
// jeden Status als freie Beschreibung nutzbar).
dropReason: z.string().max(500).optional(),
}), }),
) )
.default([]), .default([]),
+4 -1
View File
@@ -68,7 +68,10 @@ const leadCoreFields = {
nutzenHypothese: z.string().max(1000).nullable(), nutzenHypothese: z.string().max(1000).nullable(),
differenzierer: z.string().max(1000).nullable(), differenzierer: z.string().max(1000).nullable(),
naechsterSchritt: z.string().max(1000).nullable(), naechsterSchritt: z.string().max(1000).nullable(),
naechsterSchrittDatum: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).nullable(), naechsterSchrittDatum: z
.string()
.regex(/^\d{4}-\d{2}-\d{2}$/)
.nullable(),
risiken: z.string().max(1000).nullable(), risiken: z.string().max(1000).nullable(),
planB: z.string().max(1000).nullable(), planB: z.string().max(1000).nullable(),
offeneFragen: z.array(offeneFrageSchema).max(100), offeneFragen: z.array(offeneFrageSchema).max(100),
+10
View File
@@ -44,10 +44,20 @@ export const createProjectInput = z.object({
}); });
export type CreateProjectInput = z.infer<typeof createProjectInput>; export type CreateProjectInput = z.infer<typeof createProjectInput>;
export const lessonsLearnedSchema = z.object({
zielErreicht: z.string().max(2000),
aufwand: z.string().max(2000),
liefGut: z.string().max(2000),
liefSchlecht: z.string().max(2000),
});
export type LessonsLearned = z.infer<typeof lessonsLearnedSchema>;
export const archiveProjectInput = z.object({ export const archiveProjectInput = z.object({
projectId: z.string().uuid(), projectId: z.string().uuid(),
lessonsLearnedUrl: z.string().url(), lessonsLearnedUrl: z.string().url(),
abschlussvermerk: z.string().max(2000).optional(), abschlussvermerk: z.string().max(2000).optional(),
// Strukturierte Retrospektive (Lessons-Learned-Vorlage), optional.
lessonsLearned: lessonsLearnedSchema.optional(),
}); });
export type ArchiveProjectInput = z.infer<typeof archiveProjectInput>; export type ArchiveProjectInput = z.infer<typeof archiveProjectInput>;
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Minimaler Tages-Scheduler für den Backup-Sidecar: führt backup.sh einmal
# täglich zur Stunde BACKUP_HOUR (Container-TZ = Europe/Berlin) aus.
#
# Bewusst kein cron: ein simpler Poll-Loop erbt das Container-Environment
# zuverlässig (POSTGRES_PASSWORD u. a.) und hat keine busybox-cron-Eigenheiten.
set -eu
HOUR="${BACKUP_HOUR:-03}"
echo "Backup-Sidecar aktiv — täglich um ${HOUR}:00 (TZ=${TZ:-UTC}), Retention ${BACKUP_RETENTION_DAYS:-14} Tage."
while true; do
if [ "$(date +%H)" = "$HOUR" ] && [ "$(date +%M)" = "00" ]; then
/usr/local/bin/backup.sh || echo "Backup fehlgeschlagen (Exit $?)" >&2
sleep 61 # diese Minute überspringen, damit nicht doppelt ausgelöst wird
fi
sleep 30
done
+19 -9
View File
@@ -1,21 +1,31 @@
#!/bin/sh #!/bin/sh
# Tägliches pg_dump in /backups, 14 Tage Retention. # pg_dump des Cockpit-Postgres nach /backups. Custom-Format (-Fc): bereits
# Läuft im Postgres-Container via System-Cron. # komprimiert UND erlaubt selektives pg_restore — daher KEIN zusätzliches gzip.
#
# Läuft im Backup-Sidecar (docker-compose.yml service "backup") gegen den
# postgres-Service (PGHOST). Einmal pro Tag getriggert von backup-loop.sh.
# Manuell ausführbar: `docker compose exec backup /usr/local/bin/backup.sh`.
set -eu set -eu
PGHOST="${PGHOST:-postgres}"
PGUSER="${POSTGRES_USER:-cockpit}"
PGDATABASE="${POSTGRES_DB:-cockpit}"
RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-14}"
DATE=$(date +%Y%m%d-%H%M%S) DATE=$(date +%Y%m%d-%H%M%S)
OUT="/backups/cockpit-${DATE}.sql.gz" OUT="/backups/cockpit-${DATE}.dump"
mkdir -p /backups mkdir -p /backups
pg_dump -U "${POSTGRES_USER:-cockpit}" -d "${POSTGRES_DB:-cockpit}" -Fc | gzip > "$OUT" export PGPASSWORD="${POSTGRES_PASSWORD:-}"
echo "Backup written: $OUT" pg_dump -h "$PGHOST" -U "$PGUSER" -d "$PGDATABASE" -Fc -f "$OUT"
echo "Backup geschrieben: $OUT ($(du -h "$OUT" | cut -f1))"
# Retention: lösche Dumps älter als 14 Tage. # Retention: Dumps älter als N Tage löschen.
find /backups -type f -name "cockpit-*.sql.gz" -mtime +14 -delete find /backups -type f -name 'cockpit-*.dump' -mtime "+${RETENTION_DAYS}" -delete
# Heartbeat an API (logging). # Heartbeat an die API (nur Observability/Logging — macht selbst kein Backup).
if [ -n "${CRON_BEARER_TOKEN:-}" ] && [ -n "${API_URL:-}" ]; then API_URL="${API_URL:-http://api:3000}"
if [ -n "${CRON_BEARER_TOKEN:-}" ]; then
wget -q --header="Authorization: Bearer ${CRON_BEARER_TOKEN}" \ wget -q --header="Authorization: Bearer ${CRON_BEARER_TOKEN}" \
-O- "${API_URL}/internal/cron/pg-dump-backup" || true -O- "${API_URL}/internal/cron/pg-dump-backup" || true
fi fi