The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-integrations/server/models/IntegrationHistory.js

39 lines
1.0 KiB

import { Meteor } from 'meteor/meteor';
RocketChat.models.IntegrationHistory = new class IntegrationHistory extends RocketChat.models._Base {
constructor() {
super('integration_history');
}
findByType(type, options) {
if (type !== 'outgoing-webhook' || type !== 'incoming-webhook') {
throw new Meteor.Error('invalid-integration-type');
}
return this.find({ type }, options);
}
findByIntegrationId(id, options) {
return this.find({ 'integration._id': id }, options);
}
findByIntegrationIdAndCreatedBy(id, creatorId, options) {
return this.find({ 'integration._id': id, 'integration._createdBy._id': creatorId }, options);
}
findOneByIntegrationIdAndHistoryId(integrationId, historyId) {
return this.findOne({ 'integration._id': integrationId, _id: historyId });
}
findByEventName(event, options) {
return this.find({ event }, options);
}
findFailed(options) {
return this.find({ error: true }, options);
}
removeByIntegrationId(integrationId) {
return this.remove({ 'integration._id': integrationId });
}
};