@@ -140,36 +140,41 @@ func New(options *Options) *API {
140
140
)
141
141
r .Get ("/" , api .provisionerDaemons )
142
142
})
143
- r .Route ("/organizations/{organization} " , func (r chi.Router ) {
143
+ r .Route ("/organizations" , func (r chi.Router ) {
144
144
r .Use (
145
145
apiKeyMiddleware ,
146
- httpmw .ExtractOrganizationParam (options .Database ),
147
146
authRolesMiddleware ,
148
147
)
149
- r .Get ("/" , api .organization )
150
- r .Post ("/templateversions" , api .postTemplateVersionsByOrganization )
151
- r .Route ("/templates" , func (r chi.Router ) {
152
- r .Post ("/" , api .postTemplateByOrganization )
153
- r .Get ("/" , api .templatesByOrganization )
154
- r .Get ("/{templatename}" , api .templateByOrganizationAndName )
155
- })
156
- r .Route ("/workspaces" , func (r chi.Router ) {
157
- r .Post ("/" , api .postWorkspacesByOrganization )
158
- r .Get ("/" , api .workspacesByOrganization )
159
- r .Route ("/{user}" , func (r chi.Router ) {
160
- r .Use (httpmw .ExtractUserParam (options .Database ))
161
- r .Get ("/{workspacename}" , api .workspaceByOwnerAndName )
162
- r .Get ("/" , api .workspacesByOwner )
148
+ r .Post ("/" , api .postOrganizations )
149
+ r .Route ("/{organization}" , func (r chi.Router ) {
150
+ r .Use (
151
+ httpmw .ExtractOrganizationParam (options .Database ),
152
+ )
153
+ r .Get ("/" , api .organization )
154
+ r .Post ("/templateversions" , api .postTemplateVersionsByOrganization )
155
+ r .Route ("/templates" , func (r chi.Router ) {
156
+ r .Post ("/" , api .postTemplateByOrganization )
157
+ r .Get ("/" , api .templatesByOrganization )
158
+ r .Get ("/{templatename}" , api .templateByOrganizationAndName )
163
159
})
164
- })
165
- r .Route ("/members" , func (r chi.Router ) {
166
- r .Get ("/roles" , api .assignableOrgRoles )
167
- r .Route ("/{user}" , func (r chi.Router ) {
168
- r .Use (
169
- httpmw .ExtractUserParam (options .Database ),
170
- httpmw .ExtractOrganizationMemberParam (options .Database ),
171
- )
172
- r .Put ("/roles" , api .putMemberRoles )
160
+ r .Route ("/workspaces" , func (r chi.Router ) {
161
+ r .Post ("/" , api .postWorkspacesByOrganization )
162
+ r .Get ("/" , api .workspacesByOrganization )
163
+ r .Route ("/{user}" , func (r chi.Router ) {
164
+ r .Use (httpmw .ExtractUserParam (options .Database ))
165
+ r .Get ("/{workspacename}" , api .workspaceByOwnerAndName )
166
+ r .Get ("/" , api .workspacesByOwner )
167
+ })
168
+ })
169
+ r .Route ("/members" , func (r chi.Router ) {
170
+ r .Get ("/roles" , api .assignableOrgRoles )
171
+ r .Route ("/{user}" , func (r chi.Router ) {
172
+ r .Use (
173
+ httpmw .ExtractUserParam (options .Database ),
174
+ httpmw .ExtractOrganizationMemberParam (options .Database ),
175
+ )
176
+ r .Put ("/roles" , api .putMemberRoles )
177
+ })
173
178
})
174
179
})
175
180
})
@@ -252,7 +257,6 @@ func New(options *Options) *API {
252
257
253
258
r .Post ("/keys" , api .postAPIKey )
254
259
r .Route ("/organizations" , func (r chi.Router ) {
255
- r .Post ("/" , api .postOrganizationsByUser )
256
260
r .Get ("/" , api .organizationsByUser )
257
261
r .Get ("/{organizationname}" , api .organizationByUserAndName )
258
262
})
0 commit comments