Created
March 2, 2016 02:14
-
-
Save andrewjmead/f361ecb6042c48e62258 to your computer and use it in GitHub Desktop.
Keith Composite Index Sequelize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var UserTodos = sequelize.define('UserTodos', { | |
| favorite: { | |
| type: Sequelize.BOOLEAN | |
| }, | |
| UserId: { | |
| type: Sequelize.INTEGER, | |
| unique: 'compositeIndex' | |
| }, | |
| TodoId: { | |
| type: Sequelize.INTEGER, | |
| unique: 'compositeIndex' | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
original route
`app.post('/favorites/:id', middleware.requireAuthentication, function(req, res){
var favoriteId = parseInt(req.params.id, 10);
var body = {
favoriteId: favoriteId
};
});`
This will fix the error adding another function to catch the error. But it gives me a database entry with the favorite id and a Null userId. I would think it should add anything.
`app.post('/favorites/:id', middleware.requireAuthentication, function(req, res){
var favoriteId = parseInt(req.params.id, 10);
var body = {
favoriteId: favoriteId
};
});`