battlecode / galaxy

MIT License
10 stars 3 forks source link

enable tourney match lookup by external id #706

Closed acrantel closed 9 months ago

acrantel commented 9 months ago

Enables lookup of tournament matches by external id. Needed for client tourney display Updates/adds tests to cover external id query param for /tournament in matchviewset

API endpoint: api.battlecode.org/api/compete/bc23/match/tournament/ Example parameters for client: http://localhost:8000/api/compete/bc23/match/tournament/?external_id_private=privatechallongid

Example response

{
  "count": 21,
  "next": "http://localhost:8000/api/compete/bc23/match/tournament/?external_id_private=<private id here>&page=2&tournament_id=bc23tt29",
  "previous": null,
  "results": [
    {
      "id": 203,
      "status": "OK!",
      "episode": "bc23",
      "tournament_round": {
        "id": 262,
        "tournament": "bc23tt28",
        "external_id": 6,
        "name": "Round 6 (Winners)",
        "maps": [
          3
        ],
        "release_status": 2
      },
      "participants": [
        {
          "team": 35,
          "teamname": "profile",
          "submission": 141,
          "match": 203,
          "player_index": 0,
          "score": 0,
          "rating": null,
          "old_rating": 0
        },
        {
          "team": 48,
          "teamname": "aefW",
          "submission": 139,
          "match": 203,
          "player_index": 1,
          "score": 1,
          "rating": null,
          "old_rating": 0
        }
      ],
      "maps": [
        "DefaultMap"
      ],
      "alternate_order": true,
      "created": "2023-01-26T19:26:40.604934-05:00",
      "is_ranked": false,
      "replay_url": "https://storage.googleapis.com/mitbattlecode-staging-secure/episode/bc23/replays/e3572232-990b-48ee-b051-c2dbf4b14d73.bc23"
    },
  ...
  ]
}