(r *gin.RouterGroup, store apiStore, info OrgStackInfo, fetcher PeerFetcher)
| 91 | // Generic read-only models explorer (sidebar + table + detail UI). Reads |
| 92 | // the concrete store directly because it needs the runtime schema name and |
| 93 | // raw DB for tables the typed apiStore interface doesn't surface. |
| 94 | registerModelsAPI(r, store) |
| 95 | // Admin-only Operators management (the admin-console access list). Each |
| 96 | // route self-gates with RequireAdmin; mutations are audited via the group. |
| 97 | registerOperatorsAPI(r, store) |
| 98 | // Monthly per-team usage for the "Usage" page — a read-only view over the |
| 99 | // billing buffer (see usage_api.go). |
| 100 | registerUsageAPI(r, store, awsRegion) |
| 101 | } |
| 102 | |
| 103 | func registerAPIWithStore(r *gin.RouterGroup, store apiStore, info OrgStackInfo, fetcher PeerFetcher) { |
| 104 | h := &apiHandler{store: store, info: info, fetcher: fetcher} |
| 105 | |
| 106 | // Orgs CRUD |
| 107 | r.GET("/orgs", h.listOrgs) |
| 108 | r.POST("/orgs", h.createOrg) |
| 109 | r.GET("/orgs/:id", h.getOrg) |
| 110 | r.PUT("/orgs/:id", h.updateOrg) |
| 111 | r.DELETE("/orgs/:id", h.deleteOrg) |
| 112 | r.GET("/orgs/:id/warehouse", h.getManagedWarehouse) |
| 113 | r.PUT("/orgs/:id/warehouse", h.putManagedWarehouse) |
| 114 | // Focused endpoint for pinning a tenant to a specific worker image and |
| 115 | // DuckLake spec version — the operator workflow we want to be able to |
| 116 | // run without ever touching the config-store DB directly. |
| 117 | r.PATCH("/orgs/:id/warehouse/pinning", h.patchTenantPinning) |
| 118 | |
| 119 | // Org teams (duckgres_org_teams). The per-org list/upsert/delete routes |
| 120 | // (GET/POST /orgs/:id/teams, DELETE /orgs/:id/teams/:team_id) are |
| 121 | // registered by the provisioning API on this same group — gin refuses |
| 122 | // duplicate routes, so the admin surface adds only what provisioning |
| 123 | // doesn't have: the cross-org list, a CREATE-ONLY POST (org_id in the |
| 124 | // body, mirroring POST /users), and the update. The PUT is the operator |
| 125 | // break-glass: it can edit EVERY team setting, including schema_name and |
| 126 | // the legacy table-name overrides — schema immutability is a rule for the |
| 127 | // user-facing product flows, not for operators repairing rows here. |
no outgoing calls