Skip to content

chuvayva/partners_api

Repository files navigation

Partners API

The Partners API is a public Rails API application that allows users to search for partners based on location and flooring materials.

What Is Special About Me

  • 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.

How Run Locally

Docker

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

Application

The Partners API project includes a Makefile that simplifies executing common development tasks. To start the project, run:

make install
make start

Run rails console:

make console

Open application container:

make shell

Update openapi.yml from main.tsp:

make openapi-compile

How Test Locally

Run rspec tests:

make test

There 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
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published