The Partners API is a public Rails API application that allows users to search for partners based on location and flooring materials.
- The service follows API first approach based on openapi.yaml spec.
- Swagger UI based on Open API service specification.
- Open API specification autogenerated using TypeSpec.
- Auto validation of the request input provided by the openapi_first middleware.
- The service follows json:api message specification.
- Ransack is a search library.
- Kaminari is for pagination.
- Rack Attack middleware for blocking & throttling abusive requests.
- Development is fully containerized with Docker.
- Makefile has the most common commands to run the project.
- Test execution in GitHub CI
Searching for partners by location is optimized using a precomputed and indexed operating_area column in PostGIS, which allows efficient spatial queries.
The Partners API is a containerized application so you can run it using Docker. Install Docker using one of the ways from official site: https://docs.docker.com
The Partners API project includes a Makefile that simplifies executing common development tasks. To start the project, run:
make install
make startRun rails console:
make consoleOpen application container:
make shellUpdate openapi.yml from main.tsp:
make openapi-compileRun rspec tests:
make testThere are 8 Partner records created during make install phase. You can open swagger on http://localhost:3000/api-docs and make a search call with the following request body:
{
"filter": {
"flooring_materials": [1, 2],
"location": {
"latitude": 52.5163,
"longitude": 13.3777
}
},
"page": {
"number": 2,
"size": 2
}
}