Files
paliad/internal/offices/offices.go
m 495e519475 feat(t-paliad-065): firm-agnostic branding via single FIRM_NAME constant
Paliad ships firm-agnostic per CLAUDE.md ("survives firm renames") but
landing copy, email templates, page titles, and form placeholders still
hard-coded "Hogan Lovells" / "HL Patents". Replaces every user-facing
firm reference with a single source of truth: internal/branding.Name on
the server and frontend/src/branding.ts in the bundle, both reading
FIRM_NAME at startup/build time and defaulting to "HLC".

Server: branding package + boot log; auth, invite, admin_users error
strings; courts/offices/models comments; mail templates thread
{{.Firm}} via injected payload default. Files handler keeps the
upstream "HL Patents Style.dotm" path (must match mWorkRepo's blob
name) but renders the user-visible DownloadName from branding.Name.

Frontend: branding.ts read via Bun.build define so process.env.FIRM_NAME
is statically substituted into client bundles (no runtime process
reference); index/login/downloads/kostenrechner/Sidebar/ProjectFormFields
and every i18n.ts string templated against ${FIRM}.

ALLOWED_EMAIL_DOMAINS whitelist intentionally untouched — email
domains and display name rotate independently.

Verified: go build/vet/test clean; bun run build clean; FIRM_NAME=Acme
override produces "Acme" in HTML and JS bundles end-to-end.
2026-04-28 22:44:06 +02:00

43 lines
1.2 KiB
Go

// Package offices is the single source of truth for the firm's office list.
//
// The keys here must stay in sync with the CHECK constraint on
// paliad.users.office and paliad.akten.owning_office (migration 001).
package offices
// Office is a single firm office with its i18n-ready labels.
type Office struct {
Key string `json:"key"`
LabelDE string `json:"label_de"`
LabelEN string `json:"label_en"`
}
// All offices in display order. Keep in sync with the DB CHECK constraint.
var All = []Office{
{Key: "munich", LabelDE: "München", LabelEN: "Munich"},
{Key: "duesseldorf", LabelDE: "Düsseldorf", LabelEN: "Düsseldorf"},
{Key: "hamburg", LabelDE: "Hamburg", LabelEN: "Hamburg"},
{Key: "amsterdam", LabelDE: "Amsterdam", LabelEN: "Amsterdam"},
{Key: "london", LabelDE: "London", LabelEN: "London"},
{Key: "paris", LabelDE: "Paris", LabelEN: "Paris"},
{Key: "milan", LabelDE: "Mailand", LabelEN: "Milan"},
}
// IsValid reports whether the given key names a known office.
func IsValid(key string) bool {
for _, o := range All {
if o.Key == key {
return true
}
}
return false
}
// Keys returns the office keys in display order.
func Keys() []string {
keys := make([]string, len(All))
for i, o := range All {
keys[i] = o.Key
}
return keys
}