Skip to content

leonardocbrand/ozmap-challenge

 
 

Repository files navigation

🛒 OZmap Challenge

🎯 Objective:

Develop a robust RESTful API for user and location management.

🖥️ Technologies used:

NodeJS TypeScript Express.js Docker MongoDB Mongoose Mocha Chai Swagger

📋 Prerequisites:

  • Docker version 20.0.6
  • Docker compose version v2.23.0

🛠️ How to Use:

  1. Clone the repository to your machine using the command:

    git clone git@github.com:leonardocbrand/ozmap-challenge.git

  2. Switch to the leonardo-brandao branch using the command:

    git checkout leonardo-brandao

  3. Enter the repository folder and install the dependencies using the command:

    npm install

  4. Create a .env file containing the same environment variables present in the .env.example file, or use the data from the example below:

DB_PORT=27017
API_PORT=3001 
MONGODB_URI=mongodb://db:27017/oz-tech-test?authSource=admin
GOOGLE_GEOCODING_REVERSE_URL=https://maps.googleapis.com/maps/api/geocode/json?latlng=
GOOGLE_GEOCODING_URL=https://maps.googleapis.com/maps/api/geocode/json?address=
GOOGLE_API_KEY=AIzaSyCOzyNvyVumnu8GmujVFfqr4WX2IUMdWVQ
  1. Open a terminal in the repository root and run the command docker-compose up;

  2. Wait for all containers to be up and running;

  3. To view the API request logs, run the command docker logs -f ozimap-api;

📷 Preview:

Documentation 1 (Swagger)

alt text

Documentation 2 (Swagger)

alt text

Documentation 3 (Swagger)

alt text

Test Coverage

alt text

💻 Application:

Users

  • Implement a complete CRUD for users.
  • Ensure that each user contains essential information such as name, email, address, and coordinates.
  • When creating a user, allow them to provide either an address or coordinates, showing an error if both or neither are provided.
  • Use a geolocation service to resolve address ↔ coordinates, ensuring consistency in the information.
  • When updating a user's address or coordinates, follow the same logic, maintaining data integrity.

Regions

  • Implement a complete CRUD for regions.
  • Each region must have a name, coordinates, and a user who will be designated as the owner of the region.
  • Enable the listing of regions containing a specific point.
  • Allow the listing of regions at a certain distance from a point, offering the option to filter out regions not belonging to the user who made the request.

Postman

If you prefer to make requests using Postman, there is a file called postmanCollection.json in the project root to import the collections with all the requests.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 99.9%
  • Dockerfile 0.1%