This PR creates the /api/v1/reports endpoint with a GET all reports handler, and a POST new report handler.
Where should the reviewer start?
In lib/api/v1/reports.js there is the two new methods.
Any background info?
There was a lot of npm install and uninstalls done in the process here. I tried using babel to use import/export syntax, but the test suite did not like it at all, so I uninstalled everything babel. The puppeteer.js file has been refactored to use exports.methods rather then exporting each function individually.
Additional notes
As of now, the POST api endpoint does the following:
Grabs locations of the request body -> sends locations to the locations table
It DOES NOT use the Google Geoservices yet to formulate an address, so an address is hardcoded in
It creates a report using the data from the request body, and combining it with the response from the locations table -> adds the full report to the reports table.
It calls either the snowRemoval or otherForm puppeteer function depending on the request type.
Takes the data from the puppeteer function to create a confirmation311 object to send back as a response along with the newly created report object.
What does this PR do?
This PR creates the
/api/v1/reports
endpoint with a GET all reports handler, and a POST new report handler.Where should the reviewer start?
In
lib/api/v1/reports.js
there is the two new methods.Any background info?
There was a lot of npm install and uninstalls done in the process here. I tried using babel to use
import/export
syntax, but the test suite did not like it at all, so I uninstalled everything babel. Thepuppeteer.js
file has been refactored to useexports.methods
rather then exporting each function individually.Additional notes
As of now, the POST api endpoint does the following:
locations
tablereports
table.snowRemoval
orotherForm
puppeteer function depending on the request type.confirmation311
object to send back as a response along with the newly created report object.