Adds a new Slack message when connecting a channel for posting

This commit is contained in:
Tom Moor
2018-08-04 15:10:16 -07:00
parent 89ee67606f
commit 96348ced38
2 changed files with 70 additions and 8 deletions

View File

@ -1,5 +1,6 @@
// @flow
import { DataTypes, sequelize } from '../sequelize';
import events from '../events';
const Integration = sequelize.define('integration', {
id: {
@ -32,4 +33,16 @@ Integration.associate = models => {
});
};
Integration.addHook('afterCreate', async model => {
events.add({ name: 'integrations.create', model });
});
Integration.addHook('afterUpdate', model =>
events.add({ name: 'integrations.update', model })
);
Integration.addHook('afterDestroy', model =>
events.add({ name: 'integrations.delete', model })
);
export default Integration;