gancio-upstream/server/api/models/notification.js

27 lines
677 B
JavaScript

'use strict'
module.exports = (sequelize, DataTypes) => {
const notification = sequelize.define('notification', {
filters: DataTypes.JSON,
email: DataTypes.STRING,
remove_code: DataTypes.STRING,
action: {
type: DataTypes.ENUM,
values: ['Create', 'Update', 'Delete']
},
type: {
type: DataTypes.ENUM,
values: ['mail', 'admin_email', 'ap']
}
}, {
indexes: [{
unique: true,
fields: ['action', 'type']
}]
})
notification.associate = function (models) {
notification.belongsToMany(models.event, { through: 'event_notification' })
// associations can be defined here
}
return notification
}