rtate2 / i-got-next

0 stars 0 forks source link

Seed Data #4

Closed rtate2 closed 4 years ago

rtate2 commented 4 years ago

Dev Notes

Example Data Structures Teams:

 "team1": {
    "date": "",
    "player1": "",
    "player2": "",
    "player3": "",
    "player4": "",
    "player5": "",
    "name": "",
    "isWaitlist": boolean,
    "time": ""
  },

Players:

"player1":  {
    "firstName": "",
    "lastName": ""
}

const baseUrl = apiKeys.firebaseKeys.databaseURL;

const getTeams = () => new Promise((resolve, reject) => { axios.get(${baseUrl}/teams.json) .then((result) => { const allTeamsObj = result.data; const teams = []; if (allTeamsObj != null) { Object.keys(allTeamsObj).forEach((teamId) => { const newTeam = allTeamsObj[teamId]; newTeam.id = teamId; teams.push(newTeam); }) } resolve(teams); }) .catch((error) => reject(error)); });

export default { getTeams };



- Complete the same process for the rest of the collections in order to pull the data for the appropriate collection; some collections may target different keys, which will change the `.get( )` function
  - Each `.get ( )` will have its own Data file within src/helpers/data/