summaryrefslogblamecommitdiffstats
path: root/server/models/log.js
blob: 36fdf2053a1afd4b69b7159fc936b07cb5d83cd2 (plain) (tree)

























                                            
'use strict'
module.exports = (sequelize, DataTypes) => {
  var log = sequelize.define('log', {
    id: {
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      type: DataTypes.INTEGER
    },
    timestamp: DataTypes.BIGINT,
    category: DataTypes.STRING,
    description: DataTypes.STRING(2048),
    groupSnapshot: DataTypes.JSON,
    clientSnapshot: DataTypes.JSON,
    userSnapshot: DataTypes.JSON
  }, {
    timestamps: false,
    freezeTableName: true
  })
  log.associate = function (models) {
    log.belongsTo(models.group)
    log.belongsTo(models.client)
    log.belongsTo(models.user)
  }
  return log
}