k3vross / SplitCash

2 stars 0 forks source link

FSP To-Do List #1

Open mwmadsen67 opened 4 years ago

mwmadsen67 commented 4 years ago

Wiki Page Home


Database Schema


Sample State


MVP List


Backend Routes


Frontend Routes

mwmadsen67 commented 4 years ago

Hi Kevin, your docs are great, formatting is looking real clean.

Schema: Looks good overall, however I would suggest for any monetary values that you should store them as cents with an integer. Using floats with decimals can introduce weird rounding errors. All you'd have to do is convert from cents to dollars on the frontend, but all the math would be accurate if stored this way. You are also missing a friends table as a way of keeping track of which users are friends. This would be a joins table, however you will need to think about how you can keep track of the difference between just a friend request and an actual friendship.

State Shape: Again the formatting is clean, although you'll need to add a slice of state for friends information after you add that to your schema. Also think about adding associated information to certain slices of state. For example a user may have an array of billIds.

MVP List: Looks good to me

Great start Kevin, let me know if you have any questions!

k3vross commented 4 years ago

Add friendship table Added a friendship table where the user_id represents the one who initiated the friend request, friend_id represents the person receiving the request, and friendship_confirmed is a boolean where a 'false' value means the friendship is pending, and a 'true' value means is has been accepted.

Change amount to integer in schema Changed the amount datatype from float to integer which will be represented in cents.

Added 'friends' slice of state and associated data Added a friendships slice of state and added bills and friendships as associated data to the users slice of state.

mwmadsen67 commented 4 years ago

You should have a unique:true constraint on the combination of user_id and friend_id, so that people can't be friends after they're already friends.

Backend Routes: Can you remove friends on Splitwise? If so you should have a delete route. I'm not sure I understand what the show route is for.

Everything else looks good. Nice work!

k3vross commented 4 years ago

Not sure of the format for adding uniqueness with scope on the schema table, so I just added validates_uniqueness_of :user_id, scope: :friend_id as a bullet under the table.

Added delete friend backend route.

The show route shows the friend and all the bills you have together. The app doesn't really have a viewable profile for anyone, just the transaction history with whatever user you are showing, so I'm thinking that would just be a GET request to the /friends/:id

mwmadsen67 commented 4 years ago

you could say: [:user_id, :friend_id], unique: true since that is similar to what it will look like in your migration. I believe the url shortener project and art share api project has an example.

If you want to have a route return the transaction history between friends, that's really more of a bill index action nested under friends. I might say, api/friends/:friend_id/bills, and return all bills that include both the current user id and the friend id.

k3vross commented 4 years ago

Okay, fixed those. Also added associated data of comments under each bill in the schema since that is the only place to see a comment.

Should I be doing the checkmarks or is that something you should do?

mwmadsen67 commented 4 years ago

I'm personally cool with you doing the checkmarks.