{"size": 925, "ext": "js", "max_stars_repo_path": "server/dist/models/message.js", "max_stars_repo_name": "Philipeano/post-it", "max_stars_repo_stars_event_min_datetime": "2020-09-01T11:32:37.000Z", "max_stars_repo_stars_event_max_datetime": "2020-09-01T11:32:37.000Z", "max_issues_repo_path": "server/dist/models/message.js", "max_issues_repo_name": "Philipeano/post-it", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/dist/models/message.js", "max_forks_repo_name": "Philipeano/post-it", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.5555555556, "max_line_length": 51, "alphanum_fraction": 0.5783783784}
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = function (sequelize, DataTypes) {
  var Message = sequelize.define('Message', {
    id: {
      type: DataTypes.UUID,
      defaultValue: DataTypes.UUIDV1,
      primaryKey: true
    },
    content: {
      type: DataTypes.STRING,
      allowNull: false
    },
    status: {
      type: DataTypes.ENUM,
      values: ['visible', 'archived'],
      defaultValue: 'visible'
    },
    priority: {
      type: DataTypes.ENUM,
      values: ['normal', 'urgent', 'critical'],
      defaultValue: 'normal'
    }
  });

  Message.associate = function (models) {
    Message.belongsTo(models.User, {
      as: 'sender',
      foreignKey: 'senderId',
      onDelete: 'CASCADE'
    });

    Message.belongsTo(models.Group, {
      // as: 'group',
      foreignKey: 'groupId',
      onDelete: 'CASCADE'
    });
  };

  return Message;
};