cssu / trackary

Inventory & Point-of-Sale for the CSSU
https://trackary.cssu.ca
1 stars 0 forks source link

Backend Database/RESTful API #6

Closed jwebbed closed 9 years ago

jwebbed commented 10 years ago

If we're developing an api it's worth considering how we're going to structure the back end. So in terms of resources I think it would make sense to have ":products" and ":purchases". In terms of models it would make sense to have a Customer, Purchase, and Product model. Customers would have_many Purchases, Products would have_many Purchases, and Purchases would have_many Products (one customer can buy more than 1 thing) and belong_to a Customer.

Somethings to note: we haven't decided to if we want to require a tcard to purchase. I personally I'm agasint requiring it and motivating people using promotions to use it, as long term it will probably increase profits. To deal with that we'll have to have a default customer. Another thing is when people buy multiple of the same thing we'll need a way to deal with that.

elliottsj commented 10 years ago

I think we should have a sort of Order model that has many Purchases, like this:

Order

Relations:

Purchase

Properties:

Relations:

Then we can have different products in one order, and distinguish how many of a certain product was purchased in a single order

See https://github.com/cssu/trackary/pull/11