Skip to content

Peedrooo/PokeTeamAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PokeTeamAPI

This documentation outlines the usage and functionality of the PokeTeamAPI. Why did I do this? It was just a selection process that required this, and I don't want to delete it

Overview

The PokeTeamAPI provides endpoints for managing Pokémon teams associated with trainers. Trainers can create teams, retrieve information about their own team, and fetch a list of all teams.

How To Run

  1. Ensure you have docker installed on your machine. If not, you can download it here.

  2. Clone the repository.

    git clone https://github.com/Peedrooo/TriagilPokeTeamAPI.git
  3. Rename the .env.example file to .env

  4. Navigate to the root of the project and run the following command to create network and start the containers.

    docker-network create triagil-network
    docker-compose up poketeam
  5. The API will be available at http://localhost:5000.

  6. The Swagger documentation will be available at http://localhost:5000/docs.

How To Test

  1. Navigate to the root of the project and run the following command to run the tests.

    docker compose up poketeam-test

How To Stop

  1. Navigate to the root of the project and run the following command to stop the containers.

    docker-compose down

Base URL

The base URL for the Team Service API is /teams.

Endpoints

1. Create a Team

  • Endpoint: /teams
  • Method: POST
  • Description: Create a new Pokémon team for a trainer.
  • Request Body:
    {
      "user": "ash",
      "team": ["pikachu", "blastoise"]
    }
  • Response:
    • Status Code: 201 Created
    • Body:
      {
        "message": "Team created successfully",
        "status": "success",
        "data": {
          "owner": "ash",
          "pokemons": [
            {
              "name": "pikachu",
              "weight": 60,
              "height": 4
            },
            {
              "name": "blastoise",
              "weight": 85,
              "height": 16
            }
          ]
        }
      }

2. Get Team by Trainer Name

  • Endpoint: /teams/{user}
  • Method: GET
  • Description: Retrieve information about a specific trainer's Pokémon team.
  • Path Parameter:
    • user: The name of the trainer.
  • Response:
    • Status Code: 200 OK
    • Body:
      {
        "owner": "ash",
        "pokemons": [
          {
            "name": "pikachu",
            "weight": 60,
            "height": 4
          },
          {
            "name": "blastoise",
            "weight": 85,
            "height": 16
          }
        ]
      }
    • Status Code: 400 Bad Request
    • Body:
      {
        "message": "Trainer ash not found",
        "status": "error",
        "data": null
      }

3. Get All Teams

  • Endpoint: /teams
  • Method: GET
  • Description: Retrieve a list of all Pokémon teams.
  • Response:
    • Status Code: 200 OK
    • Body:
      {
        "1": {
          "owner": "ash",
          "pokemons": [
            {
              "name": "pikachu",
              "weight": 60,
              "height": 4
            },
            {
              "name": "blastoise",
              "weight": 85,
              "height": 16
            }
          ]
        },
        "2": {
          "owner": "misty",
          "pokemons": [
            {
              "name": "starmie",
              "weight": 80,
              "height": 11
            },
            {
              "name": "psyduck",
              "weight": 196,
              "height": 8
            }
          ]
        }
        // Additional teams...
      }

Database

Entity Relationship Diagram

ERD

Data Logic Diagram

DLD

Technologies Used

  • Python
  • FastAPI
  • Docker
  • Pytest
  • brmodelo

About

Python API for pokemon teams registrations

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published