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