feat(services): managed services per tenant for the portal (#77)
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 24m17s
ci / image (pull_request) Skipped

Managed Git (one Gitea instance per customer, INF-GIT-{CLD,OPR}-{STD,BUS,ENT})
is provisioned by hand; the registry now keeps the record so the portal can
show it under "Verwaltete Infrastruktur" and staff can maintain it.

- 0012_managed_services: table with kind/status checks, UNIQUE (tenant_id,
  kind, url), FK cascade on tenant delete (mirrored in the memory store).
- GET /v1/tenants/{id}/managed-services: tenant view without instance_id and
  notes; user tokens need IT_ADMIN, OWNER or CXO (else FORBIDDEN_ROLE).
- GET/POST /v1/admin/tenants/{id}/managed-services and PATCH/DELETE
  .../{sid}: staff view and maintenance, validation codes invalid_kind,
  invalid_name, invalid_url, invalid_sku, invalid_status,
  invalid_instance_id, invalid_notes; 409 duplicate.
- Audit managed_service.created/updated/deleted with the staff actor;
  updated carries the changed fields and old/new status.
- OpenAPI spec and tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-04 21:07:59 +02:00
1 parent 6141e45811
commit 3ff7ce2e92
15 files changed
+1124 -3

No files matched your search

+5
View File
@@ -72,6 +72,11 @@ func TestOpenAPISpec_loadsAndIsConsistent(t *testing.T) {
{"POST", "/v1/licences/heartbeat"},
{"POST", "/v1/licences/00000000-0000-0000-0000-000000000001/revoke"},
{"GET", "/.well-known/licence-keys.json"},
{"GET", "/v1/tenants/00000000-0000-0000-0000-000000000001/managed-services"},
{"GET", "/v1/admin/tenants/00000000-0000-0000-0000-000000000001/managed-services"},
{"POST", "/v1/admin/tenants/00000000-0000-0000-0000-000000000001/managed-services"},
{"PATCH", "/v1/admin/tenants/00000000-0000-0000-0000-000000000001/managed-services/00000000-0000-0000-0000-000000000002"},
{"DELETE", "/v1/admin/tenants/00000000-0000-0000-0000-000000000001/managed-services/00000000-0000-0000-0000-000000000002"},
}
for _, c := range cases {
req := newRequest(t, c.method, c.path)