{"size": 801, "ext": "js", "max_stars_repo_path": "models/order.js", "max_stars_repo_name": "GohelParth/Node_sequelize_Migration_Concepts", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "models/order.js", "max_issues_repo_name": "GohelParth/Node_sequelize_Migration_Concepts", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "models/order.js", "max_forks_repo_name": "GohelParth/Node_sequelize_Migration_Concepts", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.8857142857, "max_line_length": 67, "alphanum_fraction": 0.6029962547}
'use strict';
const {
  Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
  class Order extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
      Order.belongsTo(models.User, {
        foreignKey: "user_id",
        as: 'Username'
      });

      Order.belongsToMany(models.PaymentMethod, {
        through: 'OrderMethod',
        foreignKey: 'method_id'
      });
    }
  };
  Order.init({
    items: DataTypes.STRING,
    user_id: DataTypes.INTEGER
  }, {
    sequelize,
    modelName: 'Order',

  });
  // Order.sync({ alter: true });
  return Order;
};