Skip to content

Commit 4c16665

Browse files
authored
Merge pull request #168 from developmentseed/feature/add-orgs-to-docs
Add orgs to swagger docs
2 parents c2c5f7d + 0fe7889 commit 4c16665

File tree

6 files changed

+771
-33
lines changed

6 files changed

+771
-33
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
<img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square"
99
alt="Standard" />
1010
</a>
11-
</div>
11+
<a href="http://validator.swagger.io/validator/debug?url=https://raw.githubusercontent.com/developmentseed/osm-teams/master/docs/api.yml">
12+
<img src="http://validator.swagger.io/validator?url=https://raw.githubusercontent.com/developmentseed/osm-teams/master/docs/api.yml">
13+
</a>
14+
</div>
1215

1316
Check the beta 👉 <!-- markdownlint-disable MD034 -->https://mapping.team
1417
<!-- markdownlint-enable MD034 -->

app/manage/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ function manageRouter (nextApp) {
114114
return nextApp.render(req, res, '/profile')
115115
})
116116

117-
router.get('/teams/create', can('team:create'), (req, res) => {
117+
router.get('/teams/create', can('public:authenticated'), (req, res) => {
118118
return nextApp.render(req, res, '/team-create', { id: req.params.id })
119119
})
120120

121121
router.get('/teams/:id', can('team:view'), (req, res) => {
122122
return nextApp.render(req, res, '/team', { id: req.params.id })
123123
})
124124

125-
router.get('/teams/:id/edit', can('team:update'), (req, res) => {
125+
router.get('/teams/:id/edit', can('team:edit'), (req, res) => {
126126
return nextApp.render(req, res, '/team-edit', { id: req.params.id })
127127
})
128128

docs/api.md

Lines changed: 201 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ create a client
2323

2424
##### Responses
2525

26-
| Code | Description | Schema |
27-
| ---- | ----------- | ------ |
28-
| 200 | oath 2.0 client | object |
26+
| Code | Description |
27+
| ---- | ----------- |
28+
| 200 | oath 2.0 client |
2929

3030
### /clients/{id}
3131

@@ -107,7 +107,7 @@ update a team
107107
| Code | Description |
108108
| ---- | ----------- |
109109
| 200 | team updated |
110-
| 400 | error getting list of teams |
110+
| 400 | error updating team |
111111

112112
#### DELETE
113113
##### Summary:
@@ -232,3 +232,200 @@ Remove/Demote a moderator of a team. At least one moderator must exist for a tea
232232
| ---- | ----------- |
233233
| 200 | member was demoted from moderator |
234234
| 400 | error updating moderator relation |
235+
236+
### /organizations
237+
238+
#### POST
239+
##### Summary:
240+
241+
create an organization
242+
243+
##### Responses
244+
245+
| Code | Description |
246+
| ---- | ----------- |
247+
| 200 | team |
248+
249+
### /organizations/{id}
250+
251+
#### GET
252+
##### Summary:
253+
254+
get an organization
255+
256+
##### Parameters
257+
258+
| Name | Located in | Description | Required | Schema |
259+
| ---- | ---------- | ----------- | -------- | ---- |
260+
| | | | No | [OrgId](#orgid) |
261+
262+
##### Responses
263+
264+
| Code | Description |
265+
| ---- | ----------- |
266+
| 200 | organization retrieved |
267+
| 400 | error getting list of organizations |
268+
269+
#### PUT
270+
##### Summary:
271+
272+
update an organization
273+
274+
##### Parameters
275+
276+
| Name | Located in | Description | Required | Schema |
277+
| ---- | ---------- | ----------- | -------- | ---- |
278+
| | | | No | [OrgId](#orgid) |
279+
280+
##### Responses
281+
282+
| Code | Description |
283+
| ---- | ----------- |
284+
| 200 | team updated |
285+
| 400 | error updating organization |
286+
287+
#### DELETE
288+
##### Summary:
289+
290+
delete an organization
291+
292+
##### Parameters
293+
294+
| Name | Located in | Description | Required | Schema |
295+
| ---- | ---------- | ----------- | -------- | ---- |
296+
| | | | No | [OrgId](#orgid) |
297+
298+
##### Responses
299+
300+
| Code | Description |
301+
| ---- | ----------- |
302+
| 200 | organization is deleted |
303+
| 400 | error deleting organization |
304+
305+
### /organizations/{id}/addOwner/{osmId}
306+
307+
#### PUT
308+
##### Summary:
309+
310+
Assign/Promote a user to be an owner of an organization. More than one owner may exist concurrently. Owners can manage organizations of an organization.
311+
312+
313+
##### Parameters
314+
315+
| Name | Located in | Description | Required | Schema |
316+
| ---- | ---------- | ----------- | -------- | ---- |
317+
| | | | No | [OrgId](#orgid) |
318+
| | | | No | [OsmId](#osmid) |
319+
320+
##### Responses
321+
322+
| Code | Description |
323+
| ---- | ----------- |
324+
| 200 | user is promoted to owner of organization |
325+
| 400 | error updating owner relation |
326+
327+
### /organizations/{id}/removeOwner/{osmId}
328+
329+
#### PUT
330+
##### Summary:
331+
332+
Remove/Demote an owner of an organization. At least one owner must remain in the organization.
333+
334+
335+
##### Parameters
336+
337+
| Name | Located in | Description | Required | Schema |
338+
| ---- | ---------- | ----------- | -------- | ---- |
339+
| | | | No | [OrgId](#orgid) |
340+
| | | | No | [OsmId](#osmid) |
341+
342+
##### Responses
343+
344+
| Code | Description |
345+
| ---- | ----------- |
346+
| 200 | user is demoted from owner |
347+
| 400 | error updating owner relation |
348+
349+
### /organizations/{id}/addManager/{osmId}
350+
351+
#### PUT
352+
##### Summary:
353+
354+
Assign/Promote a user to be a manager of an organization. More than one manager may exist concurrently. Managers can create organizations for an organization but cannot update the organization.
355+
356+
357+
##### Parameters
358+
359+
| Name | Located in | Description | Required | Schema |
360+
| ---- | ---------- | ----------- | -------- | ---- |
361+
| | | | No | [OrgId](#orgid) |
362+
| | | | No | [OsmId](#osmid) |
363+
364+
##### Responses
365+
366+
| Code | Description |
367+
| ---- | ----------- |
368+
| 200 | user is promoted to manager of organization |
369+
| 400 | error updating owner relation |
370+
371+
### /organizations/{id}/removeManager/{osmId}
372+
373+
#### PUT
374+
##### Summary:
375+
376+
Remove/Demote manager of an organization. An org can have no managers.
377+
378+
379+
##### Parameters
380+
381+
| Name | Located in | Description | Required | Schema |
382+
| ---- | ---------- | ----------- | -------- | ---- |
383+
| | | | No | [OrgId](#orgid) |
384+
| | | | No | [OsmId](#osmid) |
385+
386+
##### Responses
387+
388+
| Code | Description |
389+
| ---- | ----------- |
390+
| 200 | user is demoted from manager of organization |
391+
| 400 | error updating owner relation |
392+
393+
### /organizations/{id}/teams
394+
395+
#### POST
396+
##### Summary:
397+
398+
Add a team to this organization. Only owners and managers can add new teams.
399+
400+
401+
##### Parameters
402+
403+
| Name | Located in | Description | Required | Schema |
404+
| ---- | ---------- | ----------- | -------- | ---- |
405+
| | | | No | [OrgId](#orgid) |
406+
407+
##### Responses
408+
409+
| Code | Description |
410+
| ---- | ----------- |
411+
| 200 | team was added successfully |
412+
| 400 | error creating team for organization |
413+
414+
#### GET
415+
##### Summary:
416+
417+
Get a list of teams for the specified organization
418+
419+
420+
##### Parameters
421+
422+
| Name | Located in | Description | Required | Schema |
423+
| ---- | ---------- | ----------- | -------- | ---- |
424+
| | | | No | [OrgId](#orgid) |
425+
426+
##### Responses
427+
428+
| Code | Description |
429+
| ---- | ----------- |
430+
| 200 | A JSON array of team objects |
431+
| 400 | error getting list of teams |

0 commit comments

Comments
 (0)