developer-job-simulation / django-rest-backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Update `/pokemon` endpoint to include a Pokémon's type

sbmsr opened this issue · comments

commented

What you need to do

Our API needs to expose a Pokemon's type. As it currently stands, a request to http://localhost:8000/pokemon/ returns:

[
	{
		"id": 1,
		"name_english": "Bulbasaur",
		"name_japanese": "フシギダネ",
		"name_chinese": "妙蛙种子",
		"name_french": "Bulbizarre",
		"hp": 45,
		"attack": 49,
		"defense": 49,
		"special_attack": 65,
		"special_defense": 65,
		"speed": 45
	},
	{
		"id": 2,
...

Expected behavior

  1. a request to http://localhost:8000/pokemon/ should return HTTP status 200 and the following JSON body:
[
	{
		"id": 1,
		"name_english": "Bulbasaur",
		"name_japanese": "フシギダネ",
		"name_chinese": "妙蛙种子",
		"name_french": "Bulbizarre",
		"hp": 45,
		"attack": 49,
		"defense": 49,
		"special_attack": 65,
		"special_defense": 65,
		"speed": 45,
		"types": [
			{
				"type": "Grass"
			},
			{
				"type": "Poison"
			}
		]
	},
	{
		"id": 2,