{"size": 575, "ext": "js", "max_stars_repo_path": "server/models/Event.js", "max_stars_repo_name": "ideasasylum/outline", "max_stars_repo_stars_event_min_datetime": "2018-07-06T20:36:19.000Z", "max_stars_repo_stars_event_max_datetime": "2019-08-03T20:50:07.000Z", "max_issues_repo_path": "server/models/Event.js", "max_issues_repo_name": "streamich/outline", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/models/Event.js", "max_forks_repo_name": "streamich/outline", "max_forks_repo_forks_event_min_datetime": "2018-08-02T16:09:27.000Z", "max_forks_repo_forks_event_max_datetime": "2019-11-26T20:28:42.000Z"}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": 5, "avg_line_length": 19.1666666667, "max_line_length": 52, "alphanum_fraction": 0.6295652174}
// @flow
import { DataTypes, sequelize } from '../sequelize';

const Event = sequelize.define('event', {
  id: {
    type: DataTypes.UUID,
    defaultValue: DataTypes.UUIDV4,
    primaryKey: true,
  },
  name: DataTypes.STRING,
  data: DataTypes.JSONB,
});

Event.associate = models => {
  Event.belongsTo(models.User, {
    as: 'user',
    foreignKey: 'userId',
  });
  Event.belongsTo(models.Collection, {
    as: 'collection',
    foreignKey: 'collectionId',
  });
  Event.belongsTo(models.Team, {
    as: 'team',
    foreignKey: 'teamId',
  });
};

export default Event;
