Files
paliad/internal/offices/offices.go
mAi 6401a8198d feat(offices): add Madrid as a firm office (mig 106)
m's ask 2026-05-20 09:42. Eighth HLC office alongside Munich,
Düsseldorf, Hamburg, Amsterdam, London, Paris, Milan.

- `internal/offices/offices.go` — append Madrid to All[] (display
  order: end of list, after Milan). Doc comment refreshed to point at
  the actual current CHECK constraints (users mig 002 + partner_units
  mig 018/024/027), not the obsolete akten reference from before
  projects-v2.
- `internal/offices/offices_test.go` — add `madrid` to the valid-keys
  table.
- mig 106 — extend the two CHECK constraints on users.office and
  partner_units.office. Idempotent (DROP IF EXISTS), audit_reason
  set_config at top, dry-run validated against the live youpc paliad
  schema (BEGIN; ALTER...; ROLLBACK).

Frontend picks up Madrid automatically via GET /api/offices.

Admin UI for managing firm office list is a separate longer-term
issue — m's "for now, just add Madrid already" path.
2026-05-20 09:52:28 +02:00

45 lines
1.4 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 constraints on
// paliad.users.office (mig 002) and paliad.partner_units.office
// (mig 018, renamed mig 024 + mig 027). Madrid added mig 106.
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"},
{Key: "madrid", LabelDE: "Madrid", LabelEN: "Madrid"},
}
// 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
}