greatday4april / the-investors-game

4 stars 1 forks source link

add action and reducer for transaction/stock/ballance #28

Closed xxxxjunwu closed 4 years ago

xxxxjunwu commented 4 years ago

There are still some unsolved yet (only prototype..).. As I am not sure where to get the data since we only have Tick model and not sure what kind of data will the model store / return.

Action:

  1. stockAction.js
    1. POJO action :
      1. buyStock(stock) :
      2. sellStock(stock)
    2. Middleware:
      1. buyingStock(userID, stockID, number)
      2. sellingStock(userID, stockID, number)
  2. ballanceAction.js
    1. POJO action:
      1. receiveBallance(ballance)
    2. MiddleWare:
      1. fetchBallance(userID)
  3. transactionAction.js
    1. POJO action:
      1. receveTransaction(transaction)
    2. MiddleWare:
      1. fetchTransaction(userID)

Reducer:

  1. stockReducer.js
    1. Case: BUY_STOCK, SELL_STOCK
  2. ballanceReducer.js
    1. case: RECEIVE_BALLANCE
  3. transactionReducer.js
    1. Case: RECEIVE_TRANSACTION