@@ -182,24 +182,6 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
182
182
return api .refreshEntitlements (ctx )
183
183
}
184
184
185
- // /organizations route
186
- api .AGPL .APISubRoutes .Organizations .Group (func (r chi.Router ) {
187
- r .Use (
188
- api .RequireFeatureMW (codersdk .FeatureMultipleOrganizations ),
189
- httpmw .RequireExperiment (api .AGPL .Experiments , codersdk .ExperimentMultiOrganization ),
190
- )
191
- r .Post ("/" , api .postOrganizations )
192
- })
193
-
194
- api .AGPL .APISubRoutes .SingleOrganization .Group (func (r chi.Router ) {
195
- r .Use (
196
- api .RequireFeatureMW (codersdk .FeatureMultipleOrganizations ),
197
- httpmw .RequireExperiment (api .AGPL .Experiments , codersdk .ExperimentMultiOrganization ),
198
- )
199
- r .Patch ("/" , api .patchOrganization )
200
- r .Delete ("/" , api .deleteOrganization )
201
- })
202
-
203
185
api .AGPL .APIHandler .Group (func (r chi.Router ) {
204
186
r .Get ("/entitlements" , api .serveEntitlements )
205
187
// /regions overrides the AGPL /regions endpoint
@@ -258,6 +240,26 @@ func New(ctx context.Context, options *Options) (_ *API, err error) {
258
240
})
259
241
})
260
242
243
+ r .Group (func (r chi.Router ) {
244
+ r .Use (
245
+ apiKeyMiddleware ,
246
+ api .RequireFeatureMW (codersdk .FeatureMultipleOrganizations ),
247
+ httpmw .RequireExperiment (api .AGPL .Experiments , codersdk .ExperimentMultiOrganization ),
248
+ )
249
+ r .Post ("/organizations" , api .postOrganizations )
250
+ })
251
+
252
+ r .Group (func (r chi.Router ) {
253
+ r .Use (
254
+ apiKeyMiddleware ,
255
+ api .RequireFeatureMW (codersdk .FeatureMultipleOrganizations ),
256
+ httpmw .RequireExperiment (api .AGPL .Experiments , codersdk .ExperimentMultiOrganization ),
257
+ httpmw .ExtractOrganizationParam (api .Database ),
258
+ )
259
+ r .Patch ("/organizations/{organization}" , api .patchOrganization )
260
+ r .Delete ("/organizations/{organization}" , api .deleteOrganization )
261
+ })
262
+
261
263
r .Route ("/organizations/{organization}/groups" , func (r chi.Router ) {
262
264
r .Use (
263
265
apiKeyMiddleware ,
0 commit comments