API criada para um processo seletivo para o cargo de dev python junior na strategi.
Precisamos criar uma ferramenta para o nosso diretor selecionar os novos membros dos vingadores e criar pequenas equipes.
-
A ferramenta precisa mostrar uma listagem de heróis, mostrando: nome, descricao e fotos.
-
O diretor gostaria de ao selecionar o herói poder salvar em uma tabela de possíveis candidatos.
-
A partir dos possíveis candidatos, montar as equipes diferenciando entre: VINGADORES e EQUIPE.
-
Você deve ter o Python instalado na máquina
-
Entre na pasta do projeto pelo terminal do linux ou pelo CLI mais adequado para seu SO
-
Crie um arquivo .env com a url de um banco postgresql
-
Execute "python -m venv venv"
-
Entre no ambiente virtual do projeto
-
Execute "pip install -r requirements.txt"
-
Execute "flask db upgrade"
-
Execute "flask run"
{
"heros": [
{
"id": 1011334,
"name": "3-D Man",
"description": "",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/c/e0/535fecbbb9784/portrait_small.jpg"
},
{
"id": 1017100,
"name": "A-Bomb (HAS)",
"description": "Rick Jones has been Hulk's best bud since day one, but now he's more than a friend...he's a teammate! Transformed by a Gamma energy explosion, A-Bomb's thick, armored skin is just as strong and powerful as it is blue. And when he curls into action, he uses it like a giant bowling ball of destruction! ",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/3/20/5232158de5b16/portrait_small.jpg"
},
{
"id": 1009144,
"name": "A.I.M.",
"description": "AIM is a terrorist organization bent on destroying the world.",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/6/20/52602f21f29ec/portrait_small.jpg"
},
{
"id": 1010699,
"name": "Aaron Stack",
"description": "",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/b/40/image_not_available/portrait_small.jpg"
}
]
}
{
"id": 1010699,
"name": "Aaron Stack",
"description": "",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/b/40/image_not_available/portrait_small.jpg"
}
{
"error": "Id not found"
}
http://localhost:5000/candidate/HERO_ID
Use o id de um hero, o novo candidato terá as informações iguais a do hero
{
"id": 1011334,
"name": "3-D Man",
"description": "",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/c/e0/535fecbbb9784/portrait_small.jpg"
}
http://localhost:5000/candidate/HERO_ID
{
"name": "Id not found"
}
http://localhost:5000/candidate/HERO_ID
{
"name": "Id already exist"
}
http://localhost:5000/candidate/ID
{
"id": 1011334,
"name": "3-D Man",
"description": "",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/c/e0/535fecbbb9784/portrait_small.jpg"
}
http://localhost:5000/candidate/ID
Not Found Page
http://localhost:5000/candidate
{
"candidates": [
{
"id": 1011334,
"name": "3-D Man",
"description": "",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/c/e0/535fecbbb9784/portrait_small.jpg",
"team_id": 2
},
{
"id": 1010699,
"name": "Aaron Stack",
"description": "",
"image": "http://i.annihil.us/u/prod/marvel/i/mg/b/40/image_not_available/portrait_small.jpg",
"team_id": null
}
]
}
http://localhost:5000/candidate/ID/exit
Remove o candidate de um team
http://localhost:5000/candidate/ID/exit
Not Found Page
http://localhost:5000/candidate/ID/exit
http://localhost:5000/candidate/ID/exit
Not Found Page
{
"name": "Alfa"
}
{
"id": 6,
"name": "Alfa",
"heros": []
}
{
"name": 0
}
{
"error": "Name should be `string` and not empty"
}
{
"teste": "Alfa"
}
{
"error": "key `name` not found"
}
{
"id": 6,
"name": "Alfa",
"heros": []
}
Not Found Page
{
"teams": [
{
"id": 3,
"name": "Caroline",
"teams": []
},
{
"id": 4,
"name": "Bravo",
"teams": []
},
{
"id": 5,
"name": "Delta",
"teams": []
},
{
"id": 2,
"name": "Fenix",
"teams": []
},
{
"id": 6,
"name": "Alfa",
"teams": []
}
]
}
{
"name": "alfa"
}
{
"name": "alfa"
}
Not Found Page
{
"name": 0
}
{
"error": "Name should be `string` and not empty"
}
{
"teste": "Alfa"
}
{
"error": "key `name` not found"
}
http://localhost:5000/team/TEAM_ID/CANDIDATE_ID
Coloca um candidate em um team
http://localhost:5000/team/TEAM_ID/CANDIDATE_ID
{
"error": "candidate id's is not found"
}
http://localhost:5000/team/TEAM_ID/CANDIDATE_ID
{
"error": "team id's is not found"
}
http://localhost:5000/team/TEAM_ID
http://localhost:5000/team/TEAM_ID
Not Found Page