GithubHelp home page GithubHelp logo

gridscale's Introduction

Test Project Setup & Execution

Requirements

  • Ensure the existence of the .env file for Environment Variables.
  • Run docker-compose up --build and wait for the server to start.
  • Two containers, api and postgres, should be up and running.
  • The API container runs on port 1337, while the Database operates on port 5432.
  • To run the tests follow this command - docker exec -it api pytest, this will run the test inside container.

Swagger Access

API Endpoints

  • GET http://127.0.0.1:1337/api/cities retrieves all cities. Apply filters for specific results.
  • POST http://127.0.0.1:1337/api/cities creates a new city.
  • GET http://127.0.0.1:1337/api/city/{city_uuid} retrieves a single city along with its allied power.
  • PUT http://127.0.0.1:1337/api/city/{city_uuid} updates a city.
  • DELETE http://127.0.0.1:1337/api/city/{city_uuid} deletes a city.

Validation Rules

  • geo_location_latitude should range between -90 and 90.
  • geo_location_longitude should range between -180 and 180.
  • For POST or PUT requests, allied_cities must reference existing cities in the database; otherwise, it raises a validation error.
  • allied_power is accessible via GET http://127.0.0.1:1337/api/city/{city_uuid} and calculates based on specific requirements (logic details).
  • Other validations are implemented using Marshmallow serializers for parsing request data and parameters.

Future Improvements

  • Implement pagination for the GET citites API.
  • Conduct thorough query optimization and refactoring to ensure DRY (Don't Repeat Yourself) principles are followed.

Read More API Doc:

Tech Stack

gridscale's People

Contributors

raianul avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.