Help

Storing links to other records with record specific data

Topic Labels: API
683 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Taste_Ink
4 - Data Explorer
4 - Data Explorer

I am building a recipe / food related app for a client. I need a recipe record to point to the ingredient records it depends on, but it also needs to have a mapping of measurements to ingredients.

I think I capture the essence of what I am trying to accomplish adequately in this JSON:

i.imgurDOTcom/42UZhlj.png

{
  id: 'bowl-of-cereal',
  name: 'Bowl of Cereal',
  ingredients: [
    // links to records in the Ingredients table.
    'milk',
    'cereal'
  ],
  measurements: {
    {
      quantity: 6,
      measurement: 'cups',
      ingredient: 'cereal',
      note: '(not stale)'
    },
    {
      quantity: 16,
      measurement: 'ounces',
      ingredient: 'milk',
      note: '(whole or skim)'
    }
  },
  directions: [ /* ... */ ]
  // etc...
}

I believe what I need to do is create a table for measurements with this^ measurement structure enforced. Is this correct or is there an alternative?

0 Replies 0