'use strict';

module.exports = function (sequelize, DataTypes) {
  var Vote = sequelize.define('Vote', {
    value: {
      type: DataTypes.INTEGER,
      allowNull: false
    },

    // associations
    BikeshedId: {
      type: DataTypes.INTEGER,
      allowNull: true
    },
    BikeId: {
      type: DataTypes.INTEGER,
      allowNull: true
    },
    UserId: {
      type: DataTypes.INTEGER,
      allowNull: true
    }
  }, {
    // paranoid: true,
    classMethods: {
      associate: function associate (models) {
        models.Vote.belongsTo(models.Bike);
        models.Vote.belongsTo(models.Bikeshed);
        models.Vote.belongsTo(models.User);
      }
    }
  });

  return Vote;
};

@@ -652,16 +652,191 @@
 .User);%0A
+      %7D,%0A      asObject: function asObject (votes) %7B%0A        var result = %7B%7D;%0A        votes.forEach(vote =%3E result%5Bvote.BikeId%5D = %7Bvalue: vote.value%7D);%0A        return result;%0A
       %7D%0A

add asObject to Vote model