Comments (7)
User endpoints added to checklist 👍
We also need an element endpoint for the different allergies (e.g. lactose, glucose)
/element(s)And
/lifestyle(s)
/goal(s)
You mean the user-based allergies, lifestyle & goals right? (e.g. /user/:id/allergies)
And last but not least, depending on the data schema, we will need an endpoint to rate substitute according to user feedback (e.g. I like the substitue, I do not like the substitute...)
This is not part of the model yet. In my opinion this should be part of "UserRecipe"-model right?
from foodo-backend.
user/:id/goal/:id
user/:id/dislike/:id
user/:id/allergy/:id
user/:id/lifestyle/:id
If we'd model it this way, we would use the id ambiguously.
req.params.id would be one of userId or goalId (e.g.).
Suggestion:
user/:id/lifestyle/:lifeStyleId
or even easier (as you'll send me an object in the body of the request anyway):
user/:id/lifestyle/
with lifestyle as json in body
from foodo-backend.
user/:id/recipe/:id (for update)
user/:id/recipe/ (for create)
Implementation as:
user/recipe (PUT) for updating with personalized recipe as JSON in body
user/recipe (POST) for inserting with personalized recipe as JSON in body
We don't need to explicitly set :id
for user in this route as the personalized recipe already includes the user's id.
from foodo-backend.
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
Added description of this in original post. We need to keep in mind to remove all :id
params in user-related routes.
from foodo-backend.
For the user profile, we need following routes to post and delete:
- user/:id/goal/:id
- user/:id/dislike/:id
- user/:id/allergy/:id
- user/:id/lifestyle/:id
- user/:id/locale/:locale (to save 'en' or 'de' as users language preference)
To create and update an user recipe, we need:
- user/:id/recipe/:id (for update)
- user/:id/recipe/ (for create)
To get all those information, we already have the endpoint auth/me, to get the current user!
We also need an element endpoint for the different allergies (e.g. lactose, glucose)
/element(s)
And
/lifestyle(s)
/goal(s)
And last but not least, depending on the data schema, we will need an endpoint to rate substitute according to user feedback (e.g. I like the substitue, I do not like the substitute...)
from foodo-backend.
This is not part of the model yet. In my opinion this should be part of "UserRecipe"-model right?
You are right, it should be!
You mean the user-based allergies, lifestyle & goals right? (e.g. /user/:id/allergies)
Exactly, a user needs to select a goal, lifestyle and allergies from a list of possible values. Those values, e.g. all goals, should be in the database and accessible like recipes or ingredients. :) So that, by calling /user/:id/goal/:id I can add the goal id from the goal endpoint to the user object.
from foodo-backend.
Exactly, a user needs to select a goal, lifestyle and allergies from a list of possible values. Those values, e.g. all goals, should be in the database and accessible like recipes or ingredients. :) So that, by calling /user/:id/goal/:id I can add the goal id from the goal endpoint to the user object.
Got this 👍 i will create a separate issue for the user-related endpoints.
Regarding UserRecipe
- how about this model?
const UserRecipeSchema = new Schema( {
user: {
type: Schema.Types.ObjectId,
ref: 'User',
},
recipe: {
id: {
type: Schema.Types.ObjectId,
ref: 'Recipe',
},
substitutions: [ {
orig: {
type: Schema.Types.ObjectId,
ref: 'Ingredient',
},
subs: [ {
id: {
type: Schema.Types.ObjectId,
ref: 'Ingredient',
},
rating: {
type: Schema.Types.Boolean,
ref: 'Recipe',
},
} ],
} ],
},
}, { collection: 'userRecipe' } );
😃
from foodo-backend.
Related Issues (20)
- Update README for Foodo early prototype
- User related endpoints /user
- PersonalizedRecipe related endpoints /user
- UserId after auth-process difficult to access
- Replace all user-related :id params
- DB rebase
- Login - If user has no account, return 404 or another fitting error code
- User Endpoint - Allergies array always empty in user object HOT 2
- UserRecipeModel - Add ClientId to DataModel HOT 1
- Get details of standard recipe
- Using proper logging HOT 1
- GetRecipeById does not populate ingredients array
- Endpoint for substitute algorithm
- Edit routes to fit to API standards
- Nicer ClientIds
- Populate Ingredients of Orig-Recipe
- Admin: Need endpoint to set allergies of ingredient
- Substituting and Reverting HOT 1
- Admin: Need endpoint to set lifestyles of ingredient
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foodo-backend.