Challenge Overview
Baton Rouge II is the one of several challenges to build out public facing mobile REST services on Heroku with Node.js to get Lab Transaction data from Heroku database. In this challenge we'd like to extend pre-existing authentication API to build out data service that access data with existing Heroku Postgres database and provides this application data via REST API in JSON format to our mobile application.
Heroku Postgres Database
This challenge provides read only functionality to Quota, Load Details and Lab Trasaction data. Following requirements and information must be considered.
- This DB Sample/Load records get updated every day on schedule every 10min
- Data volume cosidered low 800 records per day total all tables
- Data access for this API READ ONLY
- REST Service will query Quote and Lab Trasaction data on demand from Heroku Postgres database
- Schema Design SQL is available as part of this challenge
- Postgres database is on Heroku and shared among all competitors (max 20 concurrent connections)
- Table need to be part of named schema: almasalesforce
Authorization API Required Update
Need to migrate users table from public schema to be part of almasalesforce
Users table has new field growerid, that relates app user to grower Account record, Authorization API need to be modified to return this grower ID value as part of login request in addition to API KEY. Named value: growerid
REST Services Requirements
Services need to be versioned and available with authorization token that was created in prior challenge (Authorization Node.js code and documentation is avaialble as part of this challenge).
Cane Quality API service
- Version endpoint <heroku app base url>/aps/1.0/sampledata
- method: GET
- HTTP Header parameters: APSKEY - authorization API key value
- Query parameters: growerid, date
Service needs to query LabTransaction table based on Main Grower ID to get 2 recent days of samples for Yestarday & Today (current date). Return a list of samples grouped in 2 sections for today and yestarday (prior day). Return all available data fields for selected records. This data will be used by mobile app to construct 2 sample lists for Yestarday/Today
Daily Quota API service
- Version endpoint <heroku app base url>/aps/1.0/quota
- method: GET
- HTTP Header parameters: APSKEY - authorization API key value
- Query parameters: growerid, date
Service will query table Quota based on Main Grower ID to get recent day (Today current date) quota record. Return all quota fields incluing id - primary key. Note that this record may need update form user app with Quota uopdate API.
Daily Qiota Update API service
- Version endpoint <heroku app base url>/aps/1.0/quota
- method: POST
- HTTP Header parameters: APSKEY - authorization API key value
- Query parameters: quotaid, growerid, response, reason
Update Quota Service enables user to accept or change the quota and provide a reason for change. Example be (bad weather cannot deliver 20 loads only 10 available). Service will update Quota quota based on quota id key and set value for response and reason. Response value will be NULL or 'Pending' initially. When user update record it will be set to Accept, or Change and set Reson for rejection. Reason only required if grower changes the quote.
Grower is identified by alphanumeric ID, this will also identify the app user.
Shared DB Connection String: postgres://vhtvypgxgvkltk:eFDbGZSihs7n_X32_kebuEpfNu@ec2-107-21-219-142.compute-1.amazonaws.com:5432/db7v1cqe49us55
*SQL file provided to create your own copy of Postgres DB tables. Server API app needs to work with shared Heroku DB instance however due to limited connection (20) resources it is possible that it be consumed/busy. We recomend to use your wn copy of DB for development and migrate sample data from existing Postgres tables. We also provided sample data files archive to load sample data for development.
Here are additional backup databases with sample data populated:
DEV1: postgres://hohlgkfywwltfd:8kuUUQipTENV5PP3ui1F_6oeim@ec2-54-204-15-48.compute-1.amazonaws.com:5432/d1h7ljjs54tvlb
QA: postgres://cmlkbtsotpwfmy:GU5M8DK9ZjR433SKT3O90sdWtl@ec2-107-21-221-59.compute-1.amazonaws.com:5432/da6fq9fir41v9f
Final Submission Guidelines
Guidelines:
- REST API to use Node.js and Express framework
- Authentication use Node.js Passport framework
- document REST API with Apiary
- Deployment on Heroku platform
- Postgres DB - Heroku addon
Setup:
- Send an email to takumi3t9 and request to be added to the GitLabs Project Almasato Team
- Once added to the team for the Almasato repository, fork the repository, after the submission phase completes, make a merge request with your submission to this branch
- Upload documentation for how to run your submission
- Upload all your source code as a zip
- Provide a video overview of your submission