HMS-FAC / BoatlaunchMVP

MVP for Boatlaunch App
Creative Commons Zero v1.0 Universal
5 stars 0 forks source link

The existing database, (firebase) #4

Closed Conorc1000 closed 8 years ago

Conorc1000 commented 8 years ago

Here is a quick introduction to the existing database.

To view the database with a gui:

go to url - https://crackling-inferno-1794.firebaseio.com/

You will need to login using the credentials i have gittered to the team

To use firebase in your code follow these steps - https://www.firebase.com/docs/web/quickstart.html This shows the standard firebase connection but there are other specialised connections including angular and react.

The info about a slipway is stored as an array. On the client-side the previous developer (Rory) transformed the array to an object using this function:


var transformSlipway = function (slipwayArray) {

  if (typeof slipwayArray[2] === 'number') {
    slipwayArray[2] = slipwayArray[2].toString();
  }

  if (typeof slipwayArray[3] === 'number') {
    slipwayArray[3] = slipwayArray[3].toString();
  }

  return {
    idKey: slipwayArray[0] || Math.random().toString(),
    Name: slipwayArray[1],
    'longitude': slipwayArray[2],
    'latitude': slipwayArray[3],
    'Nearest Place': slipwayArray[4],
    'Country': slipwayArray[5],
    'Region': slipwayArray[6],
    'Website': slipwayArray[7],
    'Person Name': slipwayArray[8],
    'Phone Number': slipwayArray[9],
    'Mobile Phone Number': slipwayArray[10],
    'Fax Number': slipwayArray[11],
    'Email': slipwayArray[12],
    'Ramp Description': slipwayArray[13],
    'Directions': slipwayArray[14],
    'Ramp Type': slipwayArray[15],
    'Upper Area': slipwayArray[16],
    'Lower Area': slipwayArray[17],
    'Suitability': slipwayArray[18],
    'Ramp Length': slipwayArray[19],
    'Facilities': slipwayArray[20],
    'Charges': slipwayArray[21],
    'Cruising Area': slipwayArray[22],
    'Navigational Hazards': slipwayArray[23],
    'images': slipwayArray[24]
  }
};

We may wish to do this differently but this shows you the order of information on the Array.

Currently the images key/slipwayArray[24] has an array of image Strings as a value. This will be changed to a string that is another firebase URL where the images can be found. This has not been done yet.

The current size of the database is 1.8MB.

tormod17 commented 8 years ago

This function's great as it makes the data much easier to understand as it provides the key name. Quick question for Rory - why has he created a random number for the id'key' and is there anything checking to see if duplicate random numbers are being returned ? Just checked collaborators - should we be adding Rory to the Repo ?

hdrdavies commented 8 years ago

Closing this to tidy up the issues... the reference info will still be available in the closed issues