From cc13a5b8579428d2fa5c1c5dea6247ded1f7ca82 Mon Sep 17 00:00:00 2001 From: mAi Date: Tue, 26 May 2026 11:50:14 +0200 Subject: [PATCH] chore(admin): remove /admin/rules/export page + export-migrations API (t-paliad-297) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Workflow shifted to hand-written numbered migrations; the audit-row SQL export tool no longer has any consumers. Pure deletion — /admin/rules and /admin/rules/{id}/edit stay; only the export-to-SQL flow goes. Deleted: - frontend/src/admin-rules-export.tsx - frontend/src/client/admin-rules-export.ts Removed: - routes GET /admin/rules/export and GET /admin/api/rules/export-migrations - handleAdminExportRuleMigrations + handleAdminRulesExportPage - RuleEditorService.ExportMigrationsSince + ExportResult + sqlEscape helper - build.ts entries (import, client bundle, dist HTML write) - Sidebar "Regel-Migrations" nav item + "Migrations exportieren" button on /admin/rules - all admin.rules.export.* + nav.admin.rules_export + admin.rules.list.export i18n keys (DE+EN) - .admin-rules-export-* CSS rules (dead after page deletion) Doc references in design-fristen-phase2-2026-05-15.md and design-paliad-data-export-2026-05-19.md updated to mark the endpoint as removed (acceptance #2 requires grep to return zero hits). --- docs/design-fristen-phase2-2026-05-15.md | 2 +- docs/design-paliad-data-export-2026-05-19.md | 4 +- frontend/build.ts | 3 - frontend/src/admin-rules-export.tsx | 80 --------------- frontend/src/admin-rules-list.tsx | 3 - frontend/src/client/admin-rules-export.ts | 100 ------------------- frontend/src/client/i18n.ts | 38 ------- frontend/src/components/Sidebar.tsx | 1 - frontend/src/i18n-keys.ts | 18 ---- frontend/src/styles/global.css | 36 ------- internal/handlers/admin_rules.go | 19 ---- internal/handlers/handlers.go | 2 - internal/services/rule_editor_service.go | 89 ----------------- 13 files changed, 3 insertions(+), 392 deletions(-) delete mode 100644 frontend/src/admin-rules-export.tsx delete mode 100644 frontend/src/client/admin-rules-export.ts diff --git a/docs/design-fristen-phase2-2026-05-15.md b/docs/design-fristen-phase2-2026-05-15.md index 20741ea..0b447da 100644 --- a/docs/design-fristen-phase2-2026-05-15.md +++ b/docs/design-fristen-phase2-2026-05-15.md @@ -421,7 +421,7 @@ The editor is the **largest single surface** in Phase 3. ~3-4 PRs of work depend | `POST /api/admin/rules` | POST | global_admin | Create a new rule from scratch (starts as `lifecycle_state='draft'`). | | `GET /admin/rules/{id}/audit` | GET | global_admin | Audit log for this rule. | | `POST /admin/rules/{id}/preview` | POST | global_admin | Preview-on-trigger-date — runs calculator with this draft replacing its published peer; returns the resulting timeline (no persistence). | -| `POST /admin/rules/export-migration` | POST | global_admin | Export pending (draft + audit-since-last-export) rules as a `*.up.sql` blob the human can paste into `internal/db/migrations/`. Sets `migration_exported=true` on the audit rows. | +| _(removed t-paliad-297)_ migration-export endpoint | — | — | Was a SQL-export tool generating `*.up.sql` from audit rows. Workflow shifted to hand-written numbered migrations; tool removed in m/paliad#129. | ### 4.2 Draft → published lifecycle diff --git a/docs/design-paliad-data-export-2026-05-19.md b/docs/design-paliad-data-export-2026-05-19.md index 828a133..3bf3d64 100644 --- a/docs/design-paliad-data-export-2026-05-19.md +++ b/docs/design-paliad-data-export-2026-05-19.md @@ -43,7 +43,7 @@ A full org export today is **< 600 rows of user content** plus reference data **Audit trail.** Lives in `paliad.project_events` (93 rows). One row per lifecycle event with `event_type`, `metadata jsonb`, `event_date`, `created_by`. The auditing union (`AuditService.ListEntries`) joins 5 sources (project_events, partner_unit_events, deadline_rule_audit, policy_audit_log, reminder_log). For the export we treat `project_events` as primary; the four auxiliary logs are scope-specific. -**Existing export precedent.** `/admin/rules/export` + `/admin/api/rules/export-migrations` (handlers/admin_rules.go) — admin-gated, streams a generated SQL artifact. Same shape as what we want for the Excel exports. Re-use the gating helper. +**Existing export precedent.** _(Originally pointed at the admin rule-migration export. That tool was deleted in m/paliad#129 / t-paliad-297. The gating pattern — `adminGate(users, …)` on a download endpoint that streams a generated artifact — still lives on other admin handlers, e.g. `handleAdminDownloadBackup` for `/api/admin/backups/{id}/file`.)_ Re-use the gating helper. **No Go xlsx library on `go.mod` today.** This design picks **`github.com/xuri/excelize/v2`** in §3. @@ -591,7 +591,7 @@ No other slice deltas. v1 still ships slices 1+2+3. - `docs/design-data-model-v2.md` — projects + mandanten + ltree path + can_see_project predicate. - `docs/design-approval-policy-ui-2026-05-07.md` — 5-source audit union (this design adds the 6th source). - `docs/design-profession-vs-project-role-2026-05-07.md` — profession ladder for the §4 project gate. -- `internal/handlers/admin_rules.go:303` — `handleAdminExportRuleMigrations` (precedent for admin-gated export-as-download). +- `internal/handlers/backups.go` — `handleAdminDownloadBackup` (precedent for admin-gated artifact download; the older rule-migration export precedent was removed in t-paliad-297). - `internal/services/project_service.go:15` — visibility predicate. - `internal/services/derivation_service.go` — `EffectiveProjectRole` for the project gate. - `github.com/xuri/excelize/v2` — chosen xlsx library. diff --git a/frontend/build.ts b/frontend/build.ts index c22076e..b6041af 100644 --- a/frontend/build.ts +++ b/frontend/build.ts @@ -46,7 +46,6 @@ import { renderAdminApprovalPolicies } from "./src/admin-approval-policies"; import { renderAdminBroadcasts } from "./src/admin-broadcasts"; import { renderAdminRulesList } from "./src/admin-rules-list"; import { renderAdminRulesEdit } from "./src/admin-rules-edit"; -import { renderAdminRulesExport } from "./src/admin-rules-export"; import { renderPaliadin } from "./src/paliadin"; import { renderAdminPaliadin } from "./src/admin-paliadin"; import { renderAdminBackups } from "./src/admin-backups"; @@ -284,7 +283,6 @@ async function build() { join(import.meta.dir, "src/client/admin-broadcasts.ts"), join(import.meta.dir, "src/client/admin-rules-list.ts"), join(import.meta.dir, "src/client/admin-rules-edit.ts"), - join(import.meta.dir, "src/client/admin-rules-export.ts"), join(import.meta.dir, "src/client/paliadin.ts"), // t-paliad-161 — inline Paliadin widget. Loaded via the // PaliadinWidget component on every authenticated page, so the @@ -416,7 +414,6 @@ async function build() { await Bun.write(join(DIST, "admin-broadcasts.html"), renderAdminBroadcasts()); await Bun.write(join(DIST, "admin-rules-list.html"), renderAdminRulesList()); await Bun.write(join(DIST, "admin-rules-edit.html"), renderAdminRulesEdit()); - await Bun.write(join(DIST, "admin-rules-export.html"), renderAdminRulesExport()); await Bun.write(join(DIST, "paliadin.html"), renderPaliadin()); await Bun.write(join(DIST, "admin-paliadin.html"), renderAdminPaliadin()); await Bun.write(join(DIST, "admin-backups.html"), renderAdminBackups()); diff --git a/frontend/src/admin-rules-export.tsx b/frontend/src/admin-rules-export.tsx deleted file mode 100644 index f7e99d1..0000000 --- a/frontend/src/admin-rules-export.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { h } from "./jsx"; -import { Sidebar } from "./components/Sidebar"; -import { PaliadinWidget } from "./components/PaliadinWidget"; -import { BottomNav } from "./components/BottomNav"; -import { Footer } from "./components/Footer"; -import { PWAHead } from "./components/PWAHead"; - -// /admin/rules/export — Slice 11b (t-paliad-192). Surfaces the -// GET /admin/api/rules/export-migrations endpoint as a SQL preview the -// editor can copy or download. Optional ?since= query lets -// the editor scope the export to a particular audit window — empty = -// every un-exported audit row. -export function renderAdminRulesExport(): string { - return "" + ( - - - - - - - - - Regel-Migrations exportieren — Paliad - - - - - - -
-
-
-
-
-

- ← Regeln verwalten -

-

Regel-Migrations exportieren

-

- Generiert ein *.up.sql-Blob mit allen unsynchronisierten Audit-Veränderungen. - Manuell in internal/db/migrations/ einchecken. -

-
-
- -
-
- - -
- - - -
- - -
-
- -