hotosm / tasking-manager

Tasking Manager - The tool to team up for mapping in OpenStreetMap
https://wiki.openstreetmap.org/wiki/Tasking_Manager
BSD 2-Clause "Simplified" License
509 stars 275 forks source link

Change result format of list endpoints #1985

Open willemarcel opened 5 years ago

willemarcel commented 5 years ago

Change some DTOs to return data as array instead of {someData: []} when there is only one kind of data being returned. Examples: organisations, campaigns, teams, projects/{project_id}/campaigns/, countries, interests, users/queries/favorites/, /api/v2/system/authentication/applications/, /api/v2/tasks/issues/categories/.

One exception where this pattern doesn't work is when we have pagination on the result.

When there isn't results, instead of an error, it should return an empty array. The endpoints /api/v2/projects/{project_id}/comments/ and licenses are returning an error.

Related to https://github.com/hotosm/tasking-manager/issues/1930

vegeta999 commented 4 years ago

@willemarcel I wanna work on this !