Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rails_engine.md #247

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 50 additions & 44 deletions ruby_03-professional_rails_applications/rails_engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,50 +44,6 @@ You should create stories divided the following way to make sure both team membe
* Items
* Invoice Items

**Relationship Endpoints**

* Person A
* Invoices
* Items
* Invoice Items
* Person B
* Merchants
* Transactions
* Customers

**Business Intelligence Endpoints**

(This portion should be a good starting point for balancing the work. If this seems uneven let the staff know so they can make adjustments.)

* Person A
* `GET /api/v1/merchants/:id/revenue`
* `GET /api/v1/merchants/:id/revenue?date=x`
* `GET /api/v1/merchants/most_items?quantity=x`
* `GET /api/v1/customers/:id/favorite_merchant`
* `GET /api/v1/items/:id/best_day`
* `GET /api/v1/items/most_items?quantity=x`
* Person B
* `GET /api/v1/merchants/:id/customers_with_pending_invoices`
* `GET /api/v1/merchants/:id/favorite_customer`
* `GET /api/v1/items/most_revenue?quantity=x`
* `GET /api/v1/merchants/revenue?date=x`
* `GET /api/v1/merchants/most_revenue?quantity=x`

## Technical Expectations

* All endpoints will expect to return JSON data
* All endpoints should be exposed under an `api` and version (`v1`)
namespace (e.g. `/api/v1/merchants.json`)
* JSON responses should include `ids` only for associated records unless otherwise indicated (that is, don't embed the whole associated record, just the id)
* Prices are in cents, therefore you will need to transform them in dollars. (`12345` becomes `123.45`)
* Remember that for a JSON string to be valid, it needs to contain a key and a value.

### Data Importing

* You will create an ActiveRecord model for each
entity included in the [sales engine data](https://github.com/turingschool/sales_engine/tree/master/data).
* Your application should include a rake task which imports all of the CSV's and creates the corresponding records.

### Record Endpoints

#### Index of Record
Expand Down Expand Up @@ -217,6 +173,18 @@ Returns a random resource.
}
```

**Relationship Endpoints**

* Person A
* Invoices
* Items
* Invoice Items
* Person B
* Merchants
* Transactions
* Customers


### Relationship Endpoints

In addition to the direct queries against single resources, we would like to also be able to pull relationship data from the API.
Expand Down Expand Up @@ -255,6 +223,26 @@ We'll expose these relationships using nested URLs, as outlined in the sections
* `GET /api/v1/customers/:id/invoices` returns a collection of associated invoices
* `GET /api/v1/customers/:id/transactions` returns a collection of associated transactions

**Business Intelligence Endpoints**

(This portion should be a good starting point for balancing the work. If this seems uneven let the staff know so they can make adjustments.)

* Person A
* `GET /api/v1/merchants/:id/revenue`
* `GET /api/v1/merchants/:id/revenue?date=x`
* `GET /api/v1/merchants/most_items?quantity=x`
* `GET /api/v1/customers/:id/favorite_merchant`
* `GET /api/v1/items/:id/best_day`
* `GET /api/v1/items/most_items?quantity=x`
* Person B
* `GET /api/v1/merchants/:id/customers_with_pending_invoices`
* `GET /api/v1/merchants/:id/favorite_customer`
* `GET /api/v1/items/:id/best_day`
* `GET /api/v1/merchants/revenue?date=x`
* `GET /api/v1/merchants/most_revenue?quantity=x`



### Business Intelligence Endpoints

We want to maintain the original Business Intelligence functionality
Expand Down Expand Up @@ -293,6 +281,24 @@ _NOTE_: All revenues should be reported as a float with two decimal places.

* `GET /api/v1/customers/:id/favorite_merchant` returns a merchant where the customer has conducted the most successful transactions


## Technical Expectations

* All endpoints will expect to return JSON data
* All endpoints should be exposed under an `api` and version (`v1`)
namespace (e.g. `/api/v1/merchants.json`)
* JSON responses should include `ids` only for associated records unless otherwise indicated (that is, don't embed the whole associated record, just the id)
* Prices are in cents, therefore you will need to transform them in dollars. (`12345` becomes `123.45`)
* Remember that for a JSON string to be valid, it needs to contain a key and a value.

### Data Importing

* You will create an ActiveRecord model for each
entity included in the [sales engine data](https://github.com/turingschool/sales_engine/tree/master/data).
* Your application should include a rake task which imports all of the CSV's and creates the corresponding records.



## Check-in and Milestones

You will meet with an instructor in the middle of the project project. The goal of that check-in, and roughly what should be completed before the check-in is listed below.
Expand Down