Skip to content

Implementation of a new API system for handling Hits that is used by the M16 agency ๐Ÿ•ต๏ธ.

Notifications You must be signed in to change notification settings

javieramayapat/spy-agency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ•ต๏ธโ€โ™‚๏ธ API tool for manage the hits of a international spy agency

Table of Contents

๐Ÿ’กFeatures

Here are some of the project's best features:

  • Hitmen ๐Ÿ•ต๏ธ

    • List Hitmen โœ…
    • Deactivate Hitman if the hitman is retired or die in a mission โœ…
  • Users ๐Ÿง‘โ€๐Ÿ’ผ๐Ÿ‘ฉโ€๐Ÿ’ผ

    • Register user into the platform โœ…
    • Login user into the system using JWT to provide a token to users โœ…
  • Hits ๐ŸŽฏ

    • List hits โœ…
    • Hit detail โœ…
    • Create a Hit โœ…
    • Assign a Hitman toa Hit โœ…
    • Update Hit status - options(failed, completed) โœ…
    • Assign a hitman to a Manager โœ…

Extra Features

  • Use of container technology (Docker) to package code โœ…
  • Override of the user to create instances of Hitman an Manager โœ…
  • Implement JWT for manage authentication โœ…
  • Implement Swagger documentation โœ…

๐Ÿš€ API Design

In order to develop the API, I separated responsibilities for each one of them by authentication, hits and hitmen, which were the main entities.

In addition to this, I added an illustrative section of permissions by colors to which each of the system roles could access, being green for ls hitman, blue for the manager and red for the big boss.

api-design

๐Ÿ  Local enviroment

For a local enviroment I package the project using techonolgies like:

  • Docker ๐Ÿ‹
  • Docker compose ๐Ÿณ

The idea is create an isole enviroment in which can separate the services like th app and the database and connect them in an easy way through environment variables and be ready for deploy.

๐Ÿง‘โ€๐Ÿ’ป Installation Steps

  1. Clone the repository git clone git@github.com:javieramayapat/zebrands-api.git
  2. Create the env file in the root of the project .env and copy the content of the .env.example to configurate environment variables.
  3. You can run the following command to buil the image. $ docker-compose build
  4. Once the image is built, run the container: $ docker-compose up -d
  5. Run the migrations with docker-compose run app sh -c "python manage.py migrate
  6. Create a superuser with the command docker-compose run app sh -c "python manage.py createsuperuser
  7. Load the seed data files using the command docker-compose run app sh -c "python manage.py seed
  8. Now go to http://127.0.0.1:8000/docs and enjoy the app.

๐Ÿ”“ How to test the API using Token Authorization

To use the API endpoint you need to be authenticated

  1. Authenticated with your credential into auth/login/ endpoint with your username and password to get your token and request information from the API.

  2. Copy you your access token

  3. Use the Authorize button at the top of the documentation, in the value field add the prefix Token + your_token with a space in between for proper authentication.

  4. Apply the authorization and start playing with the API which is the fun part of it ๐Ÿš€.

๐Ÿš€ Demo

Demo

Licence

This project is licensed under the MIT License

๐Ÿ‘จโ€๐Ÿ’ปAuthor

Made with ๐Ÿ’™ by javieramayapat