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