developer-job-simulation/django-rest-backend

[Feature] Implement Get Pokemon by HP

sbmsr opened this issue · 0 comments

sbmsr commented

What you need to do

Our API needs to support the ability to get all Pokemon, filtered by HP

Expected behavior

  1. a request to http://localhost:8000/pokemon/hp?gt=250 should return HTTP status 200 and the following JSON body
[
	{
		"id": 242,
		"name_english": "Blissey",
		"name_japanese": "ハピナス",
		"name_chinese": "幸福蛋",
		"name_french": "Leuphorie",
		"hp": 255,
		"attack": 10,
		"defense": 10,
		"special_attack": 75,
		"special_defense": 135,
		"speed": 55,
		"types": [
			{
				"type": "Normal"
			}
		]
	}
]
  1. a request to http://localhost:8000/pokemon/hp?gt=250&lt=20 should return HTTP status 404 and the following JSON body
{
    error: "Not found"
}
  1. a request to http://localhost:8000/pokemon/hp?badComparator=200 should return HTTP status 400 and the following JSON body
{ 
    error: 'Invalid Operator. Must be one of ["gt","gte","lt","lte"]' 
}