/bops

Back Office Planning System (BOPS)

Primary LanguageRubyMIT LicenseMIT

BOPS CI

Back Office Planning System (BOPS)

Dependency Version
Ruby 2.6.5
Rails 6.0.2.2
Postgresql 1.2.3
Node 13.8.0
Yarn 1.15.2

Preflight

Clone the project

$ git clone git@github.com:unboxed/bops.git

Building the project for local development

First Time Setup without

Install the project's dependencies using bundler and yarn:

$ bundle install
$ yarn install

Enable the PostGIS extension:

Within psql's CLI, enable the postgis and postgis_topology extensions:

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;

Create the databases

$ rails db:setup

Tests

You can run the full test suite using following command:

$ rspec

Individual system specs with opening Chrome browser can be run using the following command:

$ JS_DRIVER=selenium_chrome rspec spec/system/log_in_spec.rb

Start the server:

$ rails server

Because of the subdomain being enforced, your app will be available on:

http://southwark.local.abscond.org:3000/
or
http://lambeth.local.abscond.org:3000/

##Dependencies

You will need to install wkhtmltopdf locally as this renders the PDF of the decision notice. Install this with the command:

brew install --cask wkhtmltopdf

##API

API documentation is available at /api-docs/index.html and can be autogenerated by running:

rake rswag:specs:swaggerize

Creating data through the API

Once you have the application running, you can submit planning application through the API. You can do this throught he provided swagger documentation at /api-docs/index.html

  • Click Authorize and fill in the API key ('123' if not otherwise specified at db:seed)
  • POST /api​/v1​/planning_applications > Try it out > Choose 'Full' example > Click Execute.

Working with api documentation: aggregate swagger files

We need a single openapi file to exist, but to keep the code easier to maintain we have multiple files that are then compiled into this single file:

public/api-docs/v1/_build/swagger_doc.yaml.

So to create a new api endpoint, create your yaml doc inside public/api-docs/v1 and reference it in

public/api-docs/v1/swagger_doc.yaml

like so:

  $ref: "./your_new_file_name.yaml"

Make changes to your new file, and when you're happy aggregate them into our single file by installing this package in your machine:

npm install -g swagger-cli

and running:

swagger-cli bundle public/api-docs/v1/swagger_doc.yaml --outfile public/api-docs/v1/_build/swagger_doc.yaml --type yaml