Develop a robust RESTful API for user and location management.
- Docker version 20.0.6
- Docker compose version v2.23.0
-
Clone the repository to your machine using the command:
git clone git@github.com:leonardocbrand/ozmap-challenge.git -
Switch to the leonardo-brandao branch using the command:
git checkout leonardo-brandao -
Enter the repository folder and install the dependencies using the command:
npm install -
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
-
Open a terminal in the repository root and run the command
docker-compose up; -
Wait for all containers to be up and running;
-
To view the API request logs, run the command
docker logs -f ozimap-api;
- 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.
- 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.
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.



