MerryMoney is a clone of Robinhood, which is a stock investment based app that enables users to engage in virtual market transactions reflected in real- time data.
remove companies#show since users can't create stocks
watchlists routes:
remove watchlists/:id/show since we won't work with single watchlist entities unless we're deleting
transactions routes:
remove transactions/:id/show since we won't need to get a single transaction at any given time
Frontend Routes
your user page looks like what the home page is for logged in users! Let's move this under the / frontend route and make a note that the home page is different when users are logged in vs. logged out
change watchlistIds to watchedCompanyIds; this will be an array of all the stocks/companies a user is watching
watchlists slice:
going off of the schema tweaks, watchlists will just be a join table between users and companies, so you can remove the watchlist slice on the front end. The watchedCompanyIds in the users slice of state will be all you need :)
companies slice:
Note: while the companies table in your db will not have much more information than the ticker, your front end state will hold the info you get from the third party api. This slice will have stuff like ceo, employees, etc at some point. No need to change this since our sample state CAN look like this at some point (let's say you returned a bunch of companies from your api/companies backend route, and just haven't fetched any company data from your third party api yet) but it's a good thing to be aware of
transactions slice:
Think about: if you choose to update your transactions table to have a column indicating whether a transaction is a buy or a sell, make sure to update this. If not, I'll assume all the transactions in the slice right now are sells
your user page looks like what the home page is for logged in users! Let's move this under the / frontend route and make a note that the home page is different when users are logged in vs. logged out
remove the username column since users aren't asked for a username upon signup
add portfolio_value so that you won't need to sum up all the transactions of a user to calculate this every time
watchlists table:
this table represents which stocks a user's watching, so we can remove the watchlists-companies joins table and just add a foreign key of company_id to the watchlists table. Let me know if you have questions on this!
transactions table:
need to indicate whether a given transaction is a buy or a sell. You can add a column of type bool (or string that contains true/false) that indicates that, or just have negative prices indicate buys, positive prices indicate sells. Up to you :)