feat(billing): list billing arrangements in the admin billing tab

Merged
ET
15h ago
+2283-9

Part of twentyhq/core-team-issues#2997. First half of #30271: staff can see every billing arrangement of a workspace from Admin panel > Workspace > Billing, and open one to see who added it and who ended it. Adding and ending arrangements comes in #30271, stacked on this PR.

Summary

 <SettingsAdminWorkspaceBillingContent>
   Customer, Usage, Subscription             (or "No billing data")
+  <SettingsAdminWorkspaceBillingArrangementsSection>   own query, shown with or without billing data
+    every row of any type: type, details, reason, status, starts, ends
+    row click -> <SettingsAdminWorkspaceBillingArrangementDetailsModal>   every field, the comment, added by and on, ended by
   Limits, Granted credits
workspaceBillingArrangements(workspaceId)
  every row of any type, newest first, with server-computed status and endDate,
  and the operators who added and ended it (grantedBy, revokedBy)
  • Arrangements are a self-contained admin feature, like Usage limits: AdminPanelBillingArrangementResolver (query guarded like workspaceBillingAdminPanel) and AdminPanelBillingArrangementService. AdminPanelResolver and AdminPanelBillingService are unchanged.
  • status (active, scheduled, ended, one-time) and endDate come from the server (getBillingArrangementStatus, getBillingArrangementEndDate).
  • grantedBy and revokedBy resolve the operators with one batched user query, deleted users included. An arrangement that reached its end date has no revokedBy.
  • LIMIT_OVERRIDE rows written by #29469 are listed too, and the Limits modal refetches this list after creating or deleting an override. Their details show the overridden limit (resource, operation, value, period), loaded in one query. Ending an override deletes its usage limit, so an ended one shows "Limit removed".
  • The type, seat cap mode and status enums are registered for GraphQL.

Evidence

Local lane running this branch, on a workspace with a monthly plan and the arrangements created while testing #30271:

  • The section lists every row (free seats, committed seats, credit allowances), active and ended.
  • Details. A row click on an ended committed seats row shows Added by and Ended by with the operator's name and email. An older row created without an operator shows "—".
  • A 480-character comment wraps under the details card instead of overflowing the rows.
  • generated-admin regenerated by admin codegen against the lane.
  • Scoped server and front typecheck, oxlint and oxfmt clean. Unit tests pass: billing (429), admin panel front utils (71).

Merge Danger

Door: two-way

No schema change and no write. Reverting removes one admin query and the section.

Blast Radius: admin-panel

Staff only, read-only. The Limits modal refetches one more query after creating or deleting an override.