Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. var UserActions = sequelize.define('userActions', {
  2. id: {
  3. type: DataTypes.INTEGER,
  4. primaryKey: true,
  5. autoIncrement: true
  6. },
  7. type: DataTypes.STRING
  8.  
  9. models.Item.findOne({where: {id : params.itemID}}).then(function (video){
  10. models.User.findOne({where: {id : params.itemID}}).then(function (user){
  11. if(params.applaud == "true") {
  12. console.log("Add applaud");
  13. user.addItem(video,{type:"commend"});
  14. } else {
  15. user.removeItem(item,{where: {type:"commend"}});
  16. console.log("Remove, Commendation");
  17. }
  18. res.json({'response' : 'Success'});
  19. });
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement