summaryrefslogtreecommitdiffstats
path: root/server/models/registrationhook.js
blob: 1e74288949b774c2892125d1a7485ad69b6e06a4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
'use strict'
module.exports = (sequelize, DataTypes) => {
  var registrationhook = sequelize.define('registrationhook', {
    id: {
      allowNull: false,
      autoIncrement: true,
      primaryKey: true,
      type: DataTypes.INTEGER
    },
    sortvalue: DataTypes.INTEGER,
    type: DataTypes.STRING,
    script: {
      allowNull: true,
      type: DataTypes.BLOB
    }
  }, {
    timestamps: false
  })
  registrationhook.associate = function (models) {
    var RegistrationhookXGroup = sequelize.define('registrationhook_x_group', {}, { timestamps: false, freezeTableName: true })
    registrationhook.belongsToMany(models.group, { as: 'groups', through: RegistrationhookXGroup, foreignKey: 'registrationhookId', otherKey: 'groupId' })
  }
  return registrationhook
}