ZeParceiros is a service that provides an API using REST to manage partners. This API is a solution to Zé Backend Challenge.
- Create a Partner: Save a partner in the database.
- Load Partner by ID: Retrieve a specific partner by its ID.
- Search Partner: Find the nearest partner whose coverage area includes a given location.
- Programming Language: Java
- Database: PostgreSQL
- Framework: Spring Boot (for REST API)
- GeoJSON Handling: JTS (Java Topology Suite) & PostGIS
- Containerization: Docker
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/danilo-alm/zeparceiros-api.git && cd zeparceiros-api
-
Build and start the services using Docker Compose:
docker-compose up --build
-
The API should be accessible at
http://localhost:8080
.
- URL:
/partners
- Method:
POST
- Request Body:
{ "tradingName": "Adega da Cerveja - Pinheiros", "ownerName": "Zé da Silva", "document": "1432132123891/0001", "coverageArea": { "type": "MultiPolygon", "coordinates": [ [[[30, 20], [45, 40], [10, 40], [30, 20]]], [[[15, 5], [40, 10], [10, 20], [5, 10], [15, 5]]] ] }, "address": { "type": "Point", "coordinates": [-46.57421, -21.785741] } }
- Response: Partner with ID.
- URL:
/partners/batch
- Method:
POST
- Request Body: pdvs.json
- Response: List of
Partner
- URL:
/partners/{id}
- Method:
GET
- Response:
Partner
- URL:
/partners/search
- Method:
GET
- Query Parameters:
lat
: Latitude of the locationlon
: Longitude of the location
- Response:
Partner
You can easily make requests using this Postman request collection.