Git Product home page Git Product logo

foodo-backend's People

Contributors

andrelandgraf avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

foodo-backend's Issues

DB rebase

Problem:

Users which are currently registered lack some of our required attributes (e.g. dislikes, goal,..)

Severity:

No problem as it will be set during registration process.

ToDo:

  • Create dump of current test db (or single collections)
  • Wipe models: User, Token, AuthCode
  • Test functionality, if fails restore dump

Using proper logging

Using a more sophisticated logging functionality than console.log would be quite nice especially when it comes to debugging the deployed backend on Amazon EB.
Possible packages:

UserId after auth-process difficult to access

The userId is only stored within the token (stored in req.body.token.token). Accessing the userId would require to access req.body.token.token.user._id
This is bad practice: To improve accessing the userId after a valid authentication, The userId should be stored in req.body.userId.

Substituting and Reverting

/user/recipes/substitute PUT:
{ substituteId: INGREDIENT_ID,
originalId: INGREDIENT_ID,
amount: AMOUNT_OF_SUBSTITUTE,
_id: USERRECIPE_ID }

/user/recipes/substitute DELETE:
{ historyId: ID_OF_NEW_HISTORY,
_id: USERRECIPE_ID }

Database model considerations

Question:

Below you can find the information i extracted from the db-dump of our advisors. If you want to take a look yourself at all the models and examples - i imported their entire db into a mlab mongodb:

mlab DB import

As i am responsible for designing our db model (or at least the starting layout) please give me your feedback regarding the food attributes (long list) e.g. is that enough info? Do we need more or less?

And if you have some ideas regarding the model for recipes and ingredients (examples from advisors below) just leave a comment :-)

Thanks!

Information relevant for food attributes (nutrition values of single food items & recipes) based on data from advisors:

  • Cholesterol
  • Phosphorous
  • VitaminABetaCarotin
  • Carbohydrate
  • KCal
  • Copper
  • DietaryFiber
  • TotalFat
  • VitaminB12
  • Wasser
  • Iron
  • VitaminE
  • AddedSugars
  • Calcium
  • Zinc
  • Magnesium
  • Manganese
  • VitaminARetinol
  • PUFA
  • Folate
  • Riboflavin
  • Thiamine
  • Protein
  • Salt
  • Fluoride
  • Omega3
  • VitaminB6
  • MUFA
  • AlcoholConcentrate
  • VitaminC
  • Iodine
  • SFA
  • VitaminD
  • Cholesterol
  • Phosphorous
  • VitaminABetaCarotin
  • Carbohydrate
  • KCal
  • Copper
  • DietaryFiber
  • TotalFat
  • VitaminB12
  • Wasser
  • Iron
  • VitaminE
  • AddedSugars
  • Calcium
  • Zinc
  • Magnesium
  • Manganese
  • VitaminARetinol
  • PUFA
  • Folate
  • Riboflavin
  • Thiamine
  • Protein
  • Salt
  • Fluoride
  • Omega3
  • VitaminB6
  • MUFA
  • AlcoholConcentrate
  • VitaminC
  • Iodine
  • SFA
  • VitaminD

Properties of example recipes (2,100 examples):

{
    "name": String,
    "preparationTime": Time as Int32,
    "meal": Type as String (e.g. lunch),
    "ingredients":[ Array of ingredients with their food attributes ],
    "directions": [ Strings of instruction steps ],
    "foodProperties": { same as in ingredients }
    "servings": [
        // Examples:
        {
            "name": "1/2 Rezeptmenge",
            "weight": 615
        },
        {
            "name": "1 Rezeptmenge",
            "weight": 1230
        }
    ],
    "noGoNutrition": [ Strings of probably IDs (?) maybe used for allergies],
    "imgUrl": String,
    "kcal": Int32,
    "people": "ca. 1 Liter" // unclear,
    "factor": 1 // unclear
} 

Properties of example ingredient:

{
      "dataSource": "BLS", // unclear, maybe irrelevant
      "name": String,
      "foodGroup": "Other", // ?
      "foodAttributes": { nutrition values as above }
      "servings": [ as above]
}

API routes & functions considerations

Please comment your required endpoints and their functionality below this issue.
I will split them into multiple issues once we gathered some endpoints.

Current top-level routes are:

  • /auth (for user & authentication purposes)
  • /ingredient (for all queries regarding ingredients)
  • /recipe (for all queries regarding recipes)

From my point of view there would be one route i would like to add:

  • /auth/changepw (to enable user to change his password)
  • /recipe/ (POST) with recipe as json, to insert new recipe
  • /recipe/:id (GET) to receive details of a specific standard recipe

For the user profile, we need following routes to post and delete:

  • user/:id/goal
  • user/:id/dislike
  • user/:id/allergy
  • user/:id/lifestyle
  • user/:id/locale (to save 'en' or 'de' as users language preference)

aggregated in issue #5

To create and update a user recipe, we need:

  • user/:id/recipe/ (for update)
  • user/:id/recipe/ (for create)

aggregated in issue #7

Further improvement:

All userId related endpoints will be replaced.
Reason:
The user id is provided with after validating the access token. Selection via req.params is therefore not necessary and can be replaced:

  • i.e. user/:id/allergy/ will be accessible on user/allergy

See #9 for this

User related endpoints /user

  • user/:id/goal
  • user/:id/dislike
  • user/:id/allergy
  • user/:id/lifestyle
  • user/:id/locale (to save 'en' or 'de' as users language preference)

Populate Ingredients of Orig-Recipe

For @MrMaux we need the populated ingredients array of the origRecipe in the userRecipe. Meaning that in getUserRecipe we need the ingredients also of the origRecipe to be populated in order to compare how much the nutriscore has changed.

Endpoint for substitute algorithm

We need an endpoint to get substitutes based on our algorithm.
The endpoint should be based on /recipe.

Endpoint /recipe/substitution

Nicer ClientIds

=> for second prototype:

  • Upper case first letter
  • Change applcation into Foodo Website or Foodo App

As we display the last edited by clientId, a nicer name would be a good enhancement for the second prototype.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.