This API simulates a delivery application where you can register and search partners by location.
- Docker 19.03.5 or later
- docker-compose 1.25.0 or later
For install the project just run make install
or if you prefer can run and install in the same time with make run
.
The application will run at localhost:3000
Ps.: Observe the disponibility of ips at your docker network.
Just run make deploy
- GoLang
- Docker
- MongoDB
- Lambda-local
- Hexagonal Architecture (Ports and Adapters)
This endpoint saves a Partner.
-
URL
/partners
-
Method:
POST
-
Success Response:
- Code: 200
Content:
- Code: 200
{
"id": "5e447f4f7cc7ecf5c2a900f1",
"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]
}
}
This endpoint return a Partner from a provided id.
-
URL
/partners/{id}
-
Method:
GET
-
Success Response:
- Code: 200
Content:
- Code: 200
{
"id": "5e447f4f7cc7ecf5c2a900f1",
"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]
}
}
This endpoint return nearest Partner from a provided location.
-
URL
/partners/lat/{lat}/lng/{lng}
-
Method:
GET
-
Success Response:
- Code: 200
Content:
- Code: 200
{
"id": "5e447f4f7cc7ecf5c2a900f1",
"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]
}
}