refactor(rename): handler functions, routes, legacy 301 redirects

Second rename pass closing the backend cleanup:

* handler functions (handleListProjekte, handleCreateFrist, …) renamed
  to English equivalents so every symbol in the handler package matches
  the URL/entity it serves.
* services.FristStatusFilter + filter constants renamed to
  DeadlineStatusFilter / DeadlineFilterOverdue etc.
* services.TerminListFilter / TerminCalDAVPusher / TerminSummaryCounts
  renamed to AppointmentListFilter / AppointmentCalDAVPusher /
  AppointmentSummaryCounts.
* GlossarTerm/GlossarSuggestion/glossarTerms → Glossary*.
* CourtsFeedback/CourtsResponse (formerly Gerichte*).
* handlers.Services.{Projekt,Parteien,Frist,Termin,Notiz,Dezernat} →
  {Project,Party,Deadline,Appointment,Note,Department}; dbServices
  struct + consumers likewise.
* email templates: {{.FristURL}} → {{.DeadlineURL}}, {{.FristenURL}} →
  {{.DeadlinesURL}}.
* links.go category IDs: gerichte → courts.
* cmd/server/main.go local vars: projektSvc/terminSvc/dezernatSvc →
  projectSvc/appointmentSvc/departmentSvc.

Routes:
* removed all /api/akten alias routes (API clients use /api/projects now).
* removed /api/akten/*/deadlines, /*/notes, /*/parties, /*/appointments,
  /*/checklists, /*/events, /*/summary alias variants.
* new internal/handlers/redirects.go registers 301 Moved Permanently
  redirects for every legacy German GET path: /akten, /projekte, /fristen,
  /termine, /notizen, /einstellungen, /checklisten, /dezernate, /parteien,
  /gerichte, /glossar. Sub-paths + query strings are preserved so old
  bookmarks keep working.

Kept in German (product names, per task spec):
* /tools/fristenrechner, /tools/kostenrechner, /tools/gebuehrentabellen
* FristenrechnerService / KostenrechnerService types
* User.Dezernat + paliad.users.dezernat free-text legacy column (separate
  from the new paliad.departments entity).

go build / vet / test clean.
This commit is contained in:
m
2026-04-20 17:40:55 +02:00
parent 3faec6c526
commit 49c6bc75ca
28 changed files with 314 additions and 295 deletions

View File

@@ -52,7 +52,7 @@ func main() {
// DATABASE_URL is optional during the Phase A → Phase D transition. The
// existing knowledge-platform features (Kostenrechner, Glossar, etc.) work
// without a DB. Akten/Deadline endpoints return 503 until DATABASE_URL is set.
// without a DB. matter-management endpoints return 503 until DATABASE_URL is set.
dbURL := os.Getenv("DATABASE_URL")
var svcBundle *handlers.Services
var caldavSvc *services.CalDAVService
@@ -70,9 +70,9 @@ func main() {
}
holidays := services.NewHolidayService(pool)
users := services.NewUserService(pool)
projektSvc := services.NewProjectService(pool, users)
teamSvc := services.NewTeamService(pool, projektSvc)
dezernatSvc := services.NewDepartmentService(pool, users)
projectSvc := services.NewProjectService(pool, users)
teamSvc := services.NewTeamService(pool, projectSvc)
departmentSvc := services.NewDepartmentService(pool, users)
rules := services.NewDeadlineRuleService(pool)
// Phase F: optional CalDAV cipher. If CALDAV_ENCRYPTION_KEY is unset
@@ -89,31 +89,31 @@ func main() {
log.Println("CalDAV encryption configured (AES-256-GCM)")
}
terminSvc := services.NewAppointmentService(pool, projektSvc)
caldavSvc = services.NewCalDAVService(pool, cipher, terminSvc)
appointmentSvc := services.NewAppointmentService(pool, projectSvc)
caldavSvc = services.NewCalDAVService(pool, cipher, appointmentSvc)
// Wire the push hook so user-driven mutations sync to the external
// calendar without waiting for the next 60-second tick.
terminSvc.SetCalDAVPusher(caldavSvc)
appointmentSvc.SetCalDAVPusher(caldavSvc)
baseURL := os.Getenv("PALIAD_BASE_URL")
inviteSvc := services.NewInviteService(pool, mailSvc, handlers.AllowedEmailDomains, baseURL)
reminderSvc := services.NewReminderService(pool, mailSvc, users, baseURL)
svcBundle = &handlers.Services{
Project: projektSvc,
Project: projectSvc,
Team: teamSvc,
Dezernat: dezernatSvc,
Parties: services.NewPartyService(pool, projektSvc),
Deadline: services.NewDeadlineService(pool, projektSvc),
Appointment: terminSvc,
Department: departmentSvc,
Party: services.NewPartyService(pool, projectSvc),
Deadline: services.NewDeadlineService(pool, projectSvc),
Appointment: appointmentSvc,
CalDAV: caldavSvc,
Rules: rules,
Calculator: services.NewDeadlineCalculator(holidays),
Users: users,
Fristenrechner: services.NewFristenrechnerService(rules, holidays),
Dashboard: services.NewDashboardService(pool, users),
Note: services.NewNoteService(pool, projektSvc, terminSvc),
ChecklistInst: services.NewChecklistInstanceService(pool, projektSvc),
Note: services.NewNoteService(pool, projectSvc, appointmentSvc),
ChecklistInst: services.NewChecklistInstanceService(pool, projectSvc),
Mail: mailSvc,
Invite: inviteSvc,
}
@@ -132,7 +132,7 @@ func main() {
caldavSvc.Stop()
}()
} else {
log.Println("DATABASE_URL not set — Akten/Deadline endpoints will return 503")
log.Println("DATABASE_URL not set — matter-management endpoints will return 503")
}
mux := http.NewServeMux()