developmentseed / osm-teams

Teams for OpenStreetMap!
https://mapping.team
MIT License
26 stars 5 forks source link

Inconsistent response format between `member` and `moderator` endpoints #440

Open jenningsanderson opened 1 year ago

jenningsanderson commented 1 year ago

The member endpoint is paginated while the moderator endpoint is not paginated. This seems fine, however, the response format is slightly different, which is a bit confusing:

Example: https://mapping.team/api/teams/110/moderators returns

[
  {
    "id": 151,
    "team_id": 110,
    "osm_id": 1770239
  },
...
]

While https://mapping.team/api/teams/110/members returns:

{
  "teamId": 110,
  "members": {
    "data": [
      {
        "id": 14962448,
        "name": "Abdul-Nayar Rabiatu Sungumu"
      },
      {
        "id": 4814747,
        "name": "Abdul OSM"
      },
      ...
    ],
    "pagination": {
      "total": 39,
      "lastPage": 4,
      "perPage": 10,
      "currentPage": 1,
      "from": 0,
      "to": 10
    }
  }
}

The primary inconsistency here is the difference between id and osm_id between the moderators and members.

Not a bug, just something worth documenting carefully.

jenningsanderson commented 1 year ago

One more note on pagination, the perPage argument does not work universally, so far I've only found it to work on organization teams.